Skip to content

Commit 73ad882

Browse files
committed
PMM-14431 Small refactor.
1 parent 1528a65 commit 73ad882

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

exporter/metrics.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,13 @@ func GetAllIndexesForCollections(ctx context.Context, client *mongo.Client, coll
325325
defer cursor.Close(ctx) //nolint:errcheck
326326

327327
for cursor.Next(ctx) {
328-
var idxDoc struct {
328+
var indexDoc struct {
329329
Name string `bson:"name"`
330330
}
331-
if err := cursor.Decode(&idxDoc); err != nil {
331+
if err := cursor.Decode(&indexDoc); err != nil {
332332
continue
333333
}
334-
indexNames = append(indexNames, idxDoc.Name)
334+
indexNames = append(indexNames, indexDoc.Name)
335335
}
336336
}
337337

@@ -385,13 +385,17 @@ func handleMetricSwitch(reservedNames []string, prefix, nextPrefix, k string, va
385385
res = append(res, invalidMetric)
386386
return res
387387
}
388+
389+
// makeRawMetric returns a nil metric for some data types like strings
390+
// because we cannot extract data from all types
388391
if rm == nil {
389392
return res
390393
}
391394
metrics := []*rawMetric{rm}
392395
if renamedMetrics := metricRenameAndLabel(rm, specialConversions); renamedMetrics != nil {
393396
metrics = renamedMetrics
394397
}
398+
395399
for _, m := range metrics {
396400
metric, err := rawToPrometheusMetric(m)
397401
if err != nil {

0 commit comments

Comments
 (0)