Skip to content

Conversation

krajorama
Copy link
Member

@krajorama krajorama commented Apr 24, 2025

Background

Based on https://github.com/prometheus/proposals/blob/main/proposals/2024-01-29_native_histograms_text_format.md
And OpenMetrics 2.0 WG discussions.

Changes

  • Allow structured complex types marked by "{" and "}" in the specification.
  • Allow multiple exemplars per complex type value.
  • Require that exemplars for complex type values have the timestamp. (1)
  • Be permissive about observing NaN , +Inf, -Inf. Discourage observing NaN.
  • Split histogram into ones with classic and native buckets.
  • For classic buckets, define behavior when observing NaN.
  • Define the native buckets and also how NaN is handled.
  • Define the text format of native histograms and also their exemplars.
  • Be permissive about the existence of _sum and _count series for classic histograms - for backwards compatibility.

(1) Not doing this on account of being an implementation limitation and also contradicts having backwards compatibility when exposing classic histograms as complex type.

Open questions / decisions

See OpenMetrics2.0 WG meeting notes tab

Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>

Numbers MUST be either floating points or integers. Note that ingestors of the format MAY only support float64. The non-real values NaN, +Inf and -Inf MUST be supported. NaN MUST NOT be considered a missing value, but it MAY be used to signal a division by zero.

Complex data types MUST contain all information necessary to recreate a Metric Type, with the exception of Created time and Exemplars.
Copy link
Member Author

Choose a reason for hiding this comment

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

This assume we'll have the created timestamp separate from the JSON like data. prometheus/OpenMetrics#285

Signed-off-by: György Krajcsovits <[email protected]>
@krajorama
Copy link
Member Author

Note self: add details how summaries and classic histograms one liners (so not NHCB spans/deltas) fit into it.

krajorama added 4 commits May 22, 2025 10:05
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Add semantic conventions about where complex types may occure.
Allow empty spans and deltas.
Be more precise.

Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Had some minutes to read the PR. Couldn't read everything though, I'll do a more complete review another day!

Reviewed from mobile

@beorn7 beorn7 self-requested a review May 27, 2025 11:26
krajorama added 2 commits May 27, 2025 15:53
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
@krajorama krajorama marked this pull request as ready for review May 27, 2025 14:01
@krajorama

This comment was marked as outdated.

I did not want to clutter the examples with adding "# EOF" to all,
so I made a new marker to explicitly add it on request.

There was only one faulty example where we had an extra space, see
the Exemplars section.

Signed-off-by: György Krajcsovits <[email protected]>
Allow multiple exemplars for complex types, i.e. native histograms.
But require that the timestamp is present.

Signed-off-by: György Krajcsovits <[email protected]>
@krajorama krajorama force-pushed the krajo/om2.0-native-histograms branch from c16426b to 7965787 Compare June 11, 2025 07:27
Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

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

Thanks for doing all of this.

Mostly commented about the histogram aspect (but I couldn't resist and referred to OM specific things now and then).

even unpopulated ones.

Signed-off-by: György Krajcsovits <[email protected]>
Empty may be exposed for optimizing spans.

Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Rename negative_deltas and positive_deltas to negative_buckets and
positive_buckets.

Distinguish integer and float histograms by the number format used in them.

If the number has dot "." or exponent "e", then the number is a float.
Otherwise integer.

Signed-off-by: György Krajcsovits <[email protected]>
The timestamp requirement came from current limitations in Prometheus
exemplar storage. However in the future this might be solved.

Also there's the case when a classic histogram exposes exemplars.

Signed-off-by: György Krajcsovits <[email protected]>
Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

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

Some more comments.

Sorry for adding some comments outside of a review.

I also assume that non-outdated non-resolved comments are still on your radar to deal with later.

@bwplotka bwplotka moved this to Done in Open Metrics 2.0 Sep 3, 2025
@bwplotka bwplotka moved this from Done to In Progress in Open Metrics 2.0 Sep 3, 2025
@beorn7
Copy link
Member

beorn7 commented Sep 3, 2025

Just one more note from my side. (But as said, I'm not authorized to approve OMv2 related things.)

@bwplotka
Copy link
Member

bwplotka commented Sep 3, 2025

I'm planning to go through this, but looks generally good!

@beorn7
Copy link
Member

beorn7 commented Sep 3, 2025

My comments have all been addressed. (I just don't approve this for the reasons stated previously.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants