Reject exponential histogram aggregation views for async instruments - #5461
Conversation
58a8dde to
4cd9352
Compare
4cd9352 to
64ab962
Compare
Pull request dashboard statusWaiting on the author · refreshed 2026-08-30 10:20 UTC Investigate required status check failures. Status above doesn't look right?
|
There was a problem hiding this comment.
Pull request overview
This pull request addresses a metrics SDK edge case where a View configured with ExponentialBucketHistogramAggregation on an asynchronous instrument (e.g., ObservableCounter) would previously be accepted but then produce no data points due to temporality/aggregation incompatibility. The change aligns behavior with existing handling for explicit histograms by warning and not applying the incompatible view, falling back to the default view instead.
Changes:
- Reject (warn + do not apply)
View/instrument matches where an asynchronous instrument is paired withExponentialBucketHistogramAggregation. - Add a unit test to verify the exponential-histogram + async-instrument view is rejected and the default view is used.
- Add a changelog entry documenting the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py | Extends async-instrument compatibility checks to also reject exponential histogram aggregations. |
| opentelemetry-sdk/tests/metrics/test_metric_reader_storage.py | Adds coverage for rejecting exponential histogram aggregation views on async instruments (warning emitted; default view applied). |
| .changelog/5461.fixed | Documents the behavior change/fix in the changelog system. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
The CI failures here are unrelated to this change:
This PR only touches metrics view compatibility. Could you rerun the failed jobs when you get a chance? |
Description
A
ViewconfiguringExponentialBucketHistogramAggregationon anasynchronous instrument (e.g.
ObservableCounter) is currently acceptedwithout any warning, but silently produces no data points forever:
asynchronous instruments report with CUMULATIVE instrument temporality, and
_ExponentialBucketHistogramAggregation.collect()only implements the DELTAinstrument temporality path, so every collection falls through and returns
None.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
opentelemetry-sdk/tests/metrics/test_metric_reader_storage.pyDoes This PR Require a Contrib Repo Change?
Checklist: