Skip to content

fix: omit OpenMetrics histogram sums for negative buckets - #2643

Merged
zeitlinger merged 1 commit into
mainfrom
fix/openmetrics-negative-histogram
Nov 5, 2026
Merged

zeitlinger merged 1 commit into
mainfrom
fix/openmetrics-negative-histogram

Conversation

@zeitlinger

Copy link
Copy Markdown
Member

Fixes #2631.

In OpenMetrics 1.0, a regular histogram with any negative bucket threshold must not expose a sum. This also requires omitting the paired count while retaining bucket samples. I added regression coverage for a positive sum with zero observations in the negative-threshold bucket, zero and positive threshold controls, and a gauge histogram with a negative sum. The OpenMetrics histogram specification permits negative sums for gauge histograms. Prometheus text 0.0.4 and OpenMetrics 2.0 are unchanged.

mise run lint:fix, the full unit suite, the focused regression tests, and the supplemental full install/build all pass locally; mise run build reaches Docker-dependent integration tests, which cannot run in this environment because no Docker environment is available.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
zeitlinger force-pushed the fix/openmetrics-negative-histogram branch from 2082ae6 to 44bb183 Compare November 3, 2026 13:45
@zeitlinger
zeitlinger marked this pull request as ready for review November 5, 2026 13:15
@zeitlinger
zeitlinger merged commit 532ff1e into main Nov 5, 2026
24 checks passed
@zeitlinger
zeitlinger deleted the fix/openmetrics-negative-histogram branch November 5, 2026 14:42
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.

OpenMetrics writer exposes _count/_sum for classic histograms with negative bucket thresholds

2 participants