From e28ae3eb6c3ecffb6767efda02a461dc7b1f0d66 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Mon, 30 Mar 2026 17:41:32 +0800 Subject: [PATCH] textparse: fix NaN canonicalization check in OpenMetrics getFloatValue getFloatValue was testing p.exemplarVal instead of the parsed float when normalizing NaN to the canonical representation, so metric values that were NaN were not normalized correctly. Signed-off-by: Weixie Cui --- model/textparse/openmetricsparse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/textparse/openmetricsparse.go b/model/textparse/openmetricsparse.go index 2f6671eb62..d00588df4b 100644 --- a/model/textparse/openmetricsparse.go +++ b/model/textparse/openmetricsparse.go @@ -763,7 +763,7 @@ func (p *OpenMetricsParser) getFloatValue(t token, after string) (float64, error return 0, fmt.Errorf("%w while parsing: %q", err, p.l.b[p.start:p.l.i]) } // Ensure canonical NaN value. - if math.IsNaN(p.exemplarVal) { + if math.IsNaN(val) { val = math.Float64frombits(value.NormalNaN) } return val, nil