Skip to content

NHCB: Reject custom bucket bounds with NaN value#17287

Merged
krajorama merged 1 commit intoprometheus:mainfrom
linasm:reject-nan-histogram-custom-bounds
Oct 6, 2025
Merged

NHCB: Reject custom bucket bounds with NaN value#17287
krajorama merged 1 commit intoprometheus:mainfrom
linasm:reject-nan-histogram-custom-bounds

Conversation

@linasm
Copy link
Contributor

@linasm linasm commented Oct 6, 2025

There's no way for a NaN to be usable as a valid Native Histogram Custom Bound value.
Added a validation check to prevent such values. Also, added a couple more related validation test cases.

Does this PR introduce a user-facing change?

[CHANGE] Native Histogram Custom Bounds having a NaN value will be rejected by validation.

Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
@krajorama krajorama requested review from beorn7 and krajorama and removed request for cstyan and tomwilkie October 6, 2025 14:47
Copy link
Member

@krajorama krajorama left a comment

Choose a reason for hiding this comment

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

LGTM. NaN as an upper boundary makes little sense and also https://prometheus.io/docs/specs/om/open_metrics_spec/#metric-types says "Bucket thresholds MUST NOT equal NaN." I'd be interested in a use case where people do use NaN for some reason :)

@krajorama krajorama merged commit fe11cae into prometheus:main Oct 6, 2025
45 of 46 checks passed
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.

3 participants