Skip to content

test(textparse): follow OM 2.0 composite field order in test inputs - #19890

Merged
bwplotka merged 1 commit into
mainfrom
test-om2-composite-field-order
Oct 3, 2026
Merged

bwplotka merged 1 commit into
mainfrom
test-om2-composite-field-order

Conversation

@krajorama

Copy link
Copy Markdown
Member

The OpenMetrics 2.0 specification requires the fields of a histogram composite value to appear in a fixed order (see the native-buckets and histogram-buckets ABNF rules in the spec):

If there are negative (and/or positive) Native Buckets, then the fields negative_spans, negative_buckets (and/or positive_spans, positive_buckets) MUST be present in this order after the zero_count field.

After the count and sum, the remaining fields of the Native Buckets MUST be included, then the remaining fields of the Classic Buckets (i.e. the bucket field) MUST be included.

Four inputs in openmetrics2parse_test.go did not follow this order:

  • TestOpenMetrics2ParseNativeHistogram, TestOpenMetrics2ParseFloatHistogram and TestOpenMetrics2ParseCompositeGaugeHistogram listed negative_spans/negative_buckets after the positive fields.
  • TestOpenMetrics2ParseIgnoreNativeHistograms ("dual classic and native histogram emits classic series only") listed bucket before the native fields.

The parser does not currently enforce field order, so the tests passed regardless and the expected results are unchanged. The intentionally invalid count:1,count:99 input in the spec validation test is left as is. Summary inputs already follow the required count, sum, quantile order.

NONE

🤖 Generated with Claude Code

The OpenMetrics 2.0 specification requires the fields of a histogram
composite value to appear in a fixed order: count, sum, schema,
zero_threshold, zero_count, negative_spans, negative_buckets,
positive_spans, positive_buckets and finally bucket. Some test inputs
listed the negative spans after the positive ones, or the classic
buckets before the native fields. The parser does not currently
enforce the order, so the tests passed regardless.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
@krajorama
krajorama requested a review from a team as a code owner October 2, 2026 08:34
@krajorama
krajorama requested a review from metalmatze October 2, 2026 08:34
@rbizos

rbizos commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

lgtm

@dashpole dashpole left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice. This addresses number 14 in #19745 (comment). It required #19747, IIRC.

@bwplotka
bwplotka merged commit 961c9ba into main Oct 3, 2026
38 checks passed
@bwplotka
bwplotka deleted the test-om2-composite-field-order branch October 3, 2026 13:33
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.

4 participants