Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix diagnostic data merge logic for MongoDB #963

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions exporter/diagnostic_data_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,21 @@ func (d *diagnosticDataCollector) collect(ch chan<- prometheus.Metric) {

// MongoDB 8.0 splits the diagnostic data into multiple blocks, so we need to merge them
if d.buildInfo.VersionArray[0] >= 8 { //nolint:gomnd
b := bson.M{}
for _, mv := range m {
nm := bson.M{}
for i, mv := range m {
b := bson.M{}
block, ok := mv.(bson.M)
if !ok {
continue
}
for k, v := range block {
b[k] = v
}

nm[i] = b
}
m = b

m = nm
}

metrics = makeMetrics("", m, d.topologyInfo.baseLabels(), d.compatibleMode)
Expand Down