Skip to content

Commit 780719d

Browse files
naughtyGitCattshcherbanJiriCtvrtka
authored
Arbiter fix (#607)
* disable arbiter some registries * disable arbiter some registries --------- Co-authored-by: Taras Shcherban <[email protected]> Co-authored-by: Jiří Čtvrtka <[email protected]>
1 parent b526414 commit 780719d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

exporter/exporter.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ func (e *Exporter) makeRegistry(ctx context.Context, client *mongo.Client, topol
146146
e.logger.Errorf("Registry - Cannot get node type to check if this is a mongos : %s", err)
147147
}
148148

149+
isArbiter, err := isArbiter(ctx, client)
150+
if err != nil {
151+
e.logger.Errorf("Registry - Cannot get arbiterOnly to check if this is arbiter role : %s", err)
152+
}
153+
149154
// Enable collectors like collstats and indexstats depending on the number of collections
150155
// present in the database.
151156
limitsOk := false
@@ -166,6 +171,16 @@ func (e *Exporter) makeRegistry(ctx context.Context, client *mongo.Client, topol
166171
e.opts.EnableIndexStats = true
167172
}
168173

174+
// arbiter only have isMaster privileges
175+
if isArbiter {
176+
e.opts.EnableDiagnosticData = false
177+
e.opts.EnableDBStats = false
178+
e.opts.EnableCollStats = false
179+
e.opts.EnableTopMetrics = false
180+
e.opts.EnableReplicasetStatus = false
181+
e.opts.EnableIndexStats = false
182+
}
183+
169184
// If we manually set the collection names we want or auto discovery is set.
170185
if (len(e.opts.CollStatsNamespaces) > 0 || e.opts.DiscoveringMode) && e.opts.EnableCollStats && limitsOk && requestOpts.EnableCollStats {
171186
cc := newCollectionStatsCollector(ctx, client, e.opts.Logger,

0 commit comments

Comments
 (0)