Skip to content

Parse negative span offsets in OpenMetrics native histograms - #1233

Open
auraseb wants to merge 1 commit into
prometheus:masterfrom
auraseb:fix/om-parser-negative-span-offsets
Open

auraseb wants to merge 1 commit into
prometheus:masterfrom
auraseb:fix/om-parser-negative-span-offsets

Conversation

@auraseb

@auraseb auraseb commented Oct 19, 2026

Copy link
Copy Markdown

The span regex in _parse_nh_struct only matched unsigned offsets, so a span list such as positive_spans:[-2:2] was dropped and the parsed NativeHistogram ended up with deltas but no spans. The first span offset is the starting bucket index and is negative for buckets below 1, which is common for histograms in seconds. The client's own OpenMetrics exposition writes such offsets, so its output did not round trip.

This allows an optional minus sign on span offsets, matching what the deltas regex already does, and adds a parser test with negative offsets in both positive and negative spans.

@csmarchbanks

Fixes #1232

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>

This branch has not been deployed

No deployments
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 parser drops native histogram spans with a negative offset

1 participant