feat: Allow configuring of min/max in histograms#8095
feat: Allow configuring of min/max in histograms#8095MikeGoldsmith wants to merge 10 commits intoopen-telemetry:mainfrom
Conversation
Supports disabling min/max recording to work around GCP min/max handling issues. Backward compatible - defaults to true.
Verifies min/max not tracked when disabled.
9caaa69 to
8f364a5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8095 +/- ##
============================================
- Coverage 90.32% 90.30% -0.02%
- Complexity 7607 7610 +3
============================================
Files 839 839
Lines 22888 22910 +22
Branches 2283 2295 +12
============================================
+ Hits 20673 20690 +17
- Misses 1506 1507 +1
- Partials 709 713 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jack-berg
left a comment
There was a problem hiding this comment.
Couple small comments, but looks good overall. Thanks!
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/Aggregation.java
Outdated
Show resolved
Hide resolved
...main/java/io/opentelemetry/sdk/metrics/internal/view/ExplicitBucketHistogramAggregation.java
Outdated
Show resolved
Hide resolved
...o/opentelemetry/sdk/metrics/internal/aggregator/DoubleExplicitBucketHistogramAggregator.java
Show resolved
Hide resolved
...o/opentelemetry/sdk/metrics/internal/aggregator/DoubleExplicitBucketHistogramAggregator.java
Outdated
Show resolved
Hide resolved
…nto mike/disable-histogram-minmax
- Remove @SInCE annotations (added during release flow) - Remove old create() overloads without recordMinMax, update callers - Remove redundant // read-only comment on final primitive field Claude claude-sonnet-4-6 assisted with this change.
a681c40 to
849cc50
Compare
...rc/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactoryTest.java
Outdated
Show resolved
Hide resolved
Declarative config tests compare aggregation equality via toString(), so recordMinMax must be included for the comparisons to be valid. Claude claude-sonnet-4-6 assisted with this change.
jack-berg
left a comment
There was a problem hiding this comment.
Will leave open for a few days to see if any other @open-telemetry/java-approvers have feedback about the new public API surface area
I finally got a chance to look at this. I'm slightly concerned about adding a simple boolean option to this. If we end up with more of them in the future, the API surface could end up exploding in non-optimal ways. What would y'all think about creating an AggregationOptions type that would encapsulate this new option, and also provide a place to put future options, when/if they crop up? |
Thought more on this, and I'm not sure. Other existing Histogram options (maxBuckets, maxScale, and bucketBoundaries) all use the same in-line design. Adding an Options class just for recordMinMax feels excessive, especially if we don't know of any other options that might come along? @jkwatson is this something you feel strongly about adding? |
…nto mike/disable-histogram-minmax
Maybe we should put all the current options into an HistogramAggregationOptions as well, rather than continue the sub-optimal combinatoric parameter approach? |
Sure, I could look at doing that. |
Replace boolean recordMinMax params on Aggregation factory methods with a HistogramOptions builder, providing a single extensible place for future histogram options without requiring new method overloads. Claude claude-sonnet-4-6 assisted with this change.
|
@jkwatson I've updated to use an options builder for the |
Summary
Adds support for disabling min/max recording in histogram aggregations per the OpenTelemetry spec.
Fixes #7859
Motivation
Some users need the ability to disable min/max recording in histograms. The OpenTelemetry spec requires this parameter for both explicit and exponential histogram aggregations.
Changes
HistogramOptionsbuilder to encapsulate histogram behavioral options (currentlyrecordMinMax), providing an extensible place for future options without method overload explosionAggregation.explicitBucketHistogram(List<Double>, HistogramOptions)andAggregation.base2ExponentialBucketHistogram(int, int, HistogramOptions)record_min_maxfrom YAML to SDKHistogramOptionsdefault torecordMinMax=trueTesting
DoubleExplicitBucketHistogramAggregatorTest.testRecordMinMaxDisabled— verifies min/max not tracked when disabled for explicit histogramsDoubleBase2ExponentialHistogramAggregatorTest.testRecordMinMaxDisabled— verifies min/max not tracked when disabled for exponential histograms