MCPcopy Index your code
hub / github.com/prometheus/prometheus / normalizeFloatsInLabelValues

Function normalizeFloatsInLabelValues

model/textparse/openmetricsparse.go:774–782  ·  view source on GitHub ↗

normalizeFloatsInLabelValues ensures that values of the "le" labels of classic histograms and "quantile" labels of summaries follow OpenMetrics formatting rules.

(t model.MetricType, l, v string)

Source from the content-addressed store, hash-verified

772// normalizeFloatsInLabelValues ensures that values of the "le" labels of classic histograms and "quantile" labels
773// of summaries follow OpenMetrics formatting rules.
774func normalizeFloatsInLabelValues(t model.MetricType, l, v string) string {
775 if (t == model.MetricTypeSummary && l == model.QuantileLabel) || (t == model.MetricTypeHistogram && l == model.BucketLabel) {
776 f, err := strconv.ParseFloat(v, 64)
777 if err == nil {
778 return labels.FormatOpenMetricsFloat(f)
779 }
780 }
781 return v
782}

Callers 2

LabelsMethod · 0.85
LabelsMethod · 0.85

Calls 1

FormatOpenMetricsFloatFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…