Skip to content

Commit 5d9f518

Browse files
PMM-9458 Disable DBStats and TopMetrics where limit is active. (#417)
* PMM-9458 Proposed solution * PMM-9458 Improve help- Co-authored-by: Carlos Salguero <[email protected]>
1 parent 4284ef2 commit 5d9f518

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

exporter/exporter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func (e *Exporter) makeRegistry(ctx context.Context, client *mongo.Client, topol
192192
registry.MustRegister(&ddc)
193193
}
194194

195-
if e.opts.EnableDBStats && requestOpts.EnableDBStats {
195+
if e.opts.EnableDBStats && limitsOk && requestOpts.EnableDBStats {
196196
cc := dbstatsCollector{
197197
ctx: ctx,
198198
client: client,
@@ -203,7 +203,7 @@ func (e *Exporter) makeRegistry(ctx context.Context, client *mongo.Client, topol
203203
registry.MustRegister(&cc)
204204
}
205205

206-
if e.opts.EnableTopMetrics && nodeType != typeMongos && requestOpts.EnableTopMetrics {
206+
if e.opts.EnableTopMetrics && nodeType != typeMongos && limitsOk && requestOpts.EnableTopMetrics {
207207
tc := topCollector{
208208
ctx: ctx,
209209
client: client,

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type GlobalFlags struct {
5353

5454
CollectAll bool `name:"collect-all" help:"Enable all collectors. Same as specifying all --collector.<name>"`
5555

56-
CollStatsLimit int `name:"collector.collstats-limit" help:"Disable collstats, dbstat, topmetrics and indexstats collector if there are more than <n> collections. 0=No limit" default:"0"`
56+
CollStatsLimit int `name:"collector.collstats-limit" help:"Disable collstats, dbstats, topmetrics and indexstats collector if there are more than <n> collections. 0=No limit" default:"0"`
5757

5858
DiscoveringMode bool `name:"discovering-mode" help:"Enable autodiscover collections" negatable:""`
5959
CompatibleMode bool `name:"compatible-mode" help:"Enable old mongodb-exporter compatible metrics" negatable:""`

0 commit comments

Comments
 (0)