use the metric's ValueType (#162)

Signed-off-by: Kyle Allan <kallan357@gmail.com>

Co-authored-by: Kyle Allan <kallan@singularity6.com>
This commit is contained in:
Kyle Allan 2022-07-01 03:20:07 -04:00 committed by GitHub
parent 0d37fabd21
commit 83189c5e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,7 @@ func (mc JSONMetricCollector) Collect(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(
m.Desc,
prometheus.UntypedValue,
m.ValueType,
floatValue,
extractLabels(mc.Logger, mc.Data, m.LabelsJSONPaths)...,
)
@ -92,7 +92,7 @@ func (mc JSONMetricCollector) Collect(ch chan<- prometheus.Metric) {
if floatValue, err := SanitizeValue(value); err == nil {
ch <- prometheus.MustNewConstMetric(
m.Desc,
prometheus.UntypedValue,
m.ValueType,
floatValue,
extractLabels(mc.Logger, jdata, m.LabelsJSONPaths)...,
)