Skip to content

Omit histogram bucket_counts when there are no explicit_bounds - #9095

Open
adityad171 wants to merge 1 commit into
open-telemetry:mainfrom
adityad171:fix/7238-histogram-no-bucket-bounds
Open

adityad171 wants to merge 1 commit into
open-telemetry:mainfrom
adityad171:fix/7238-histogram-no-bucket-bounds

Conversation

@adityad171

Copy link
Copy Markdown
Contributor

Fixes #7238

A histogram point with no bucket boundaries is exported with bucket_counts=[count] and no explicit_bounds. The proto says such a point must omit both fields. This affects empty boundary advice, Micrometer timers without SLOs, and the SDK's own otel.sdk.* duration histograms.

Both histogram marshalers now skip bucket_counts when explicit_bounds is empty. Points with boundaries are unchanged.

Compatibility

This changes the wire output for these points. These consumers expect today's form:

Testing

The two updated tests in MetricsRequestMarshalerTest fail without the fix. :exporters:otlp:common:check passes on JDK 25, and the tests also pass on Java 8.

Parts of this change were written with an AI coding assistant; I reviewed and tested all of it.

A histogram point with no bucket boundaries, for example from
setExplicitBucketBoundariesAdvice(emptyList()) or a Micrometer timer
without SLOs, was exported with bucket_counts=[count] and no
explicit_bounds. The OTLP proto says a histogram without a distribution
must omit both fields.

Skip bucket_counts in HistogramDataPointMarshaler and
HistogramDataPointStatelessMarshaler when there are no boundaries, and
update the two marshaler tests that expected the old output.
@adityad171
adityad171 requested a review from a team as a code owner December 3, 2026 16:22
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-12-03 17:23 UTC

Investigate required status check failures.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (e91fe6d) to head (2608d92).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9095      +/-   ##
============================================
- Coverage     90.54%   90.53%   -0.01%     
- Complexity    11254    11258       +4     
============================================
  Files          1040     1040              
  Lines         30703    30708       +5     
  Branches       4015     4019       +4     
============================================
+ Hits          27799    27802       +3     
  Misses         1928     1928              
- Partials        976      978       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

histogram without distribution of values transmits bucket_counts but not explicit_bounds using the micrometer timer

1 participant