mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-09 08:32:26 -04:00
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 <cuiweixie@gmail.com>
This commit is contained in:
parent
d6c18a4d62
commit
e28ae3eb6c
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue