Skip to content

Commit

Permalink
Change option to use internal server id
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
  • Loading branch information
wallyqs committed Jul 13, 2019
1 parent e3c1626 commit 9af0a92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type NATSExporterOptions struct {
HTTPUser string // User in metrics scrape by prometheus.
HTTPPassword string
Prefix string
UseOldServerID bool
UseInternalServerID bool
}

//NATSExporter collects NATS metrics
Expand Down
4 changes: 2 additions & 2 deletions prometheus_nats_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func main() {
flag.StringVar(&opts.HTTPUser, "http_user", "", "Enable basic auth and set user name for HTTP scrapes.")
flag.StringVar(&opts.HTTPPassword, "http_pass", "", "Set the password for HTTP scrapes. NATS bcrypt supported.")
flag.StringVar(&opts.Prefix, "prefix", "", "Set the prefix for all the metrics.")
flag.BoolVar(&opts.UseOldServerID, "use_old_server_id", false, "Disables using ServerID from /varz")
flag.BoolVar(&opts.UseInternalServerID, "use_internal_server_id", false, "Enables using ServerID from /varz")
flag.Parse()

opts.RetryInterval = time.Duration(retryInterval) * time.Second
Expand Down Expand Up @@ -147,7 +147,7 @@ necessary.`)
// Create an instance of the NATS exporter.
exp := exporter.NewExporter(opts)

if len(args) == 1 && !opts.UseOldServerID {
if len(args) == 1 && opts.UseInternalServerID {
// Pick the server id from the /varz endpoint info.
url := flag.Args()[0]
id := collector.GetServerIDFromVarz(url, opts.RetryInterval)
Expand Down

0 comments on commit 9af0a92

Please sign in to comment.