Skip to content

Commit 1374361

Browse files
authored
Merge pull request #15 from yansal/fix/fix-conversion-function-litteral
fix: fix conversion function litteral
2 parents af0caf1 + b4587b6 commit 1374361

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: collector.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -408,22 +408,24 @@ func makeDescMap(metricMaps map[string]map[string]ColumnMapping, namespace strin
408408
}
409409

410410
for columnName, columnMapping := range mappings {
411+
factor := columnMapping.factor
412+
411413
// Determine how to convert the column based on its usage.
412414
switch columnMapping.usage {
413415
case COUNTER:
414416
thisMap[columnName] = MetricMap{
415417
vtype: prometheus.CounterValue,
416418
desc: prometheus.NewDesc(fmt.Sprintf("%s_%s_%s", namespace, metricNamespace, columnMapping.metric), columnMapping.description, labels, nil),
417419
conversion: func(in interface{}) (float64, bool) {
418-
return dbToFloat64(in, columnMapping.factor)
420+
return dbToFloat64(in, factor)
419421
},
420422
}
421423
case GAUGE:
422424
thisMap[columnName] = MetricMap{
423425
vtype: prometheus.GaugeValue,
424426
desc: prometheus.NewDesc(fmt.Sprintf("%s_%s_%s", namespace, metricNamespace, columnMapping.metric), columnMapping.description, labels, nil),
425427
conversion: func(in interface{}) (float64, bool) {
426-
return dbToFloat64(in, columnMapping.factor)
428+
return dbToFloat64(in, factor)
427429
},
428430
}
429431
}

0 commit comments

Comments
 (0)