Skip to content

Commit

Permalink
Add command line flag to disable metrics about the exporter it-self (#…
Browse files Browse the repository at this point in the history
…885)

PR #356 introduced an API option to disable default exporter metrics (process_* and go_*).
However there is no command line flag to actually set this option. This change adds
the command line flag `--no-collector.exporter-metrics` to disable those metrics.

Signed-off-by: Christian Pointner <[email protected]>
Co-authored-by: Roman Novikov <[email protected]>
  • Loading branch information
equinox0815 and rnovikovP authored Aug 16, 2024
1 parent 7b587d0 commit e065c15
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type GlobalFlags struct {
LogLevel string `name:"log.level" help:"Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]" enum:"debug,info,warn,error,fatal" default:"error"`
ConnectTimeoutMS int `name:"mongodb.connect-timeout-ms" help:"Connection timeout in milliseconds" default:"5000"`

EnableExporterMetrics bool `name:"collector.exporter-metrics" help:"Enable collecting metrics about the exporter itself (process_*, go_*)" negatable:"" default:"True"`
EnableDiagnosticData bool `name:"collector.diagnosticdata" help:"Enable collecting metrics from getDiagnosticData"`
EnableReplicasetStatus bool `name:"collector.replicasetstatus" help:"Enable collecting metrics from replSetGetStatus"`
EnableDBStats bool `name:"collector.dbstats" help:"Enable collecting metrics from dbStats"`
Expand Down Expand Up @@ -147,6 +148,7 @@ func buildExporter(opts GlobalFlags, uri string, log *logrus.Logger) *exporter.E
ConnectTimeoutMS: opts.ConnectTimeoutMS,
TimeoutOffset: opts.TimeoutOffset,

DisableDefaultRegistry: !opts.EnableExporterMetrics,
EnableDiagnosticData: opts.EnableDiagnosticData,
EnableReplicasetStatus: opts.EnableReplicasetStatus,
EnableCurrentopMetrics: opts.EnableCurrentopMetrics,
Expand Down

0 comments on commit e065c15

Please sign in to comment.