Skip to content

OM 2.0: do not allow NaN in histogram counts and bucket values - #3208

Open
krajorama wants to merge 2 commits into
prometheus:mainfrom
krajorama:om2-histogram-nan-counts
Open

krajorama wants to merge 2 commits into
prometheus:mainfrom
krajorama:om2-histogram-nan-counts

Conversation

@krajorama

@krajorama krajorama commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Triggered by prometheus/prometheus#20606

Changes Count, Gcount and bucket values of Histograms and GaugeHistograms from SHOULD NOT be NaN to MUST NOT be NaN.

Reasons:

  • Agrees with OpenMetrics 1.0, which already disallowed NaN bucket values for both Histograms and GaugeHistograms.
  • A NaN Count or bucket value cannot be shown to be monotonically increasing, so it cannot be a counter value.
  • The invariants of the spec, which also apply to GaugeHistograms, cannot hold with NaN: Count equal to the +Inf bucket, Count equal to the sum of the Native Buckets (plus NaN observations), and Classic Buckets being cumulative.

Also clarifies that "NaN value" in the Classic and Native Buckets sections refers to the NaN measurement value, not a bucket value, fixes "MUST BE" to "MUST be", and bumps the version to 2.0.0-rc2.

The migration guide needs no change, because this keeps the OpenMetrics 1.0 behaviour.

🤖 Generated with Claude Code

Change Count, Gcount and bucket values of Histograms and GaugeHistograms
from SHOULD NOT be NaN to MUST NOT be NaN. This agrees with OpenMetrics
1.0, which already disallowed NaN bucket values for both types. A NaN
Count or bucket value cannot be shown to be monotonically increasing,
and invariants such as the Count being equal to the +Inf bucket or to
the sum of the Native Buckets, and Classic Buckets being cumulative,
cannot hold with NaN.

Clarify that "NaN value" in the Classic and Native Buckets sections
refers to the NaN measurement value, not a bucket value.

Bump version to 2.0.0-rc2.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bwplotka
bwplotka previously approved these changes Dec 1, 2026

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM mod date

Comment thread docs/specs/om/open_metrics_spec_2_0.md Resolved
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants