prom-client: NaN metric is not reported

Not A Number (NaN) is a supported metric according to EXPOSITION FORMATS

value is a float represented as required by Go’s ParseFloat() function. In addition to standard numerical values, Nan, +Inf, and -Inf are valid values representing not a number, positive infinity, and negative infinity, respectively.

However, this is not tracked when doing the following:

var nanGauge = Prometheus.Client.Metrics.CreateGauge("nan", "metric with nan value");
nanGauge.Set(double.NaN);

Expected Outcome

# HELP nan metric with nan value
# TYPE nan gauge
Nan

Actual Outcome

# HELP nan metric with nan value
# TYPE nan gauge

Repro

Pull https://github.com/tomkerkhove/prometheus-nan-repro and consume /repro endpoint.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 32 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Sure that’s fine - Thanks!

That would be prefect for me! Thanks for considering!