Skip to content

[surfacers.otel] Export native distributions as exponential histograms - #1515

Merged
manugarg merged 2 commits into
mainfrom
otel-native-hist
Oct 2, 2026
Merged

manugarg merged 2 commits into
mainfrom
otel-native-hist

Conversation

@manugarg

@manugarg manugarg commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Second part of native histogram support (#1480), after #1514. Distributions with native buckets are now exported as OTel exponential histograms instead of explicit-bucket histograms. Nothing changes for regular distributions.

  • Mapping — OTel's exponential histogram uses the same bucket boundaries as native buckets, so this is a direct conversion: Scale is the schema, and count, sum and zero count carry over. Zero threshold is 0.
  • Bucket numbering — OTel's bucket i covers (base^i, base^(i+1)], while native bucket i covers (base^(i-1), base^i]. So native bucket i goes out as OTel bucket i-1.
  • Dense counts — OTel takes a contiguous array of counts starting at an offset, so empty buckets between the lowest and the highest filled one are sent as zeros.
  • Temporality — same as for regular distributions: cumulative, or delta for gauge metrics.

Testing

Unit tests cover the conversion, including values that are exactly on bucket boundaries, zeros and negative values.

Also ran cloudprober with latency_distribution { native_buckets {} } and the OTLP/HTTP exporter pointed at a small local receiver that decodes the request. cloudprober_latency arrived as an exponential histogram (scale 3, cumulative), and its offset and bucket counts matched the file surfacer output for the same data. Not tested against a real collector or backend.

OTel's exponential histogram uses the same bucket boundaries as native
buckets (scale is the same as schema), so distributions with native
buckets map to it directly. The only difference is in bucket numbering:
native bucket i is OTel's bucket i-1.

Regular distributions are still exported as explicit bucket histograms.

Part of #1480.
@manugarg
manugarg marked this pull request as ready for review October 2, 2026 07:20
@manugarg
manugarg merged commit 7c23730 into main Oct 2, 2026
13 checks passed
@manugarg
manugarg deleted the otel-native-hist branch October 2, 2026 07:21
@manugarg manugarg added this to the v0.14.7 milestone Oct 4, 2026
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.

1 participant