Skip to content

Commit 90b52af

Browse files
feat: Allow configuring of min/max in histograms (#8095)
Co-authored-by: Jack Berg <34418638+jack-berg@users.noreply.github.com>
1 parent 6e17a4a commit 90b52af

File tree

25 files changed

+589
-87
lines changed

25 files changed

+589
-87
lines changed
Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
11
Comparing source compatibility of opentelemetry-sdk-metrics-1.60.0-SNAPSHOT.jar against opentelemetry-sdk-metrics-1.59.0.jar
2-
No changes.
2+
*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.metrics.Aggregation (not serializable)
3+
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
4+
=== UNCHANGED METHOD: PUBLIC STATIC io.opentelemetry.sdk.metrics.Aggregation base2ExponentialBucketHistogram(int, int)
5+
+++ NEW ANNOTATION: java.lang.Deprecated
6+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.Aggregation base2ExponentialBucketHistogram(io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions)
7+
=== UNCHANGED METHOD: PUBLIC STATIC io.opentelemetry.sdk.metrics.Aggregation explicitBucketHistogram(java.util.List<java.lang.Double><java.lang.Double>)
8+
+++ NEW ANNOTATION: java.lang.Deprecated
9+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.Aggregation explicitBucketHistogram(io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions)
10+
+++ NEW CLASS: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions (not serializable)
11+
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
12+
+++ NEW SUPERCLASS: java.lang.Object
13+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions$Builder builder()
14+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions getDefault()
15+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getMaxBuckets()
16+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getMaxScale()
17+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) boolean getRecordMinMax()
18+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions$Builder toBuilder()
19+
+++ NEW CLASS: PUBLIC(+) ABSTRACT(+) STATIC(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions$Builder (not serializable)
20+
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
21+
+++ NEW SUPERCLASS: java.lang.Object
22+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions build()
23+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions$Builder setMaxBuckets(int)
24+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions$Builder setMaxScale(int)
25+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions$Builder setRecordMinMax(boolean)
26+
+++ NEW CLASS: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions (not serializable)
27+
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
28+
+++ NEW SUPERCLASS: java.lang.Object
29+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions$Builder builder()
30+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.util.List<java.lang.Double> getBucketBoundaries()
31+
+++ NEW ANNOTATION: javax.annotation.Nullable
32+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions getDefault()
33+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) boolean getRecordMinMax()
34+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions$Builder toBuilder()
35+
+++ NEW CLASS: PUBLIC(+) ABSTRACT(+) STATIC(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions$Builder (not serializable)
36+
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
37+
+++ NEW SUPERCLASS: java.lang.Object
38+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions build()
39+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions$Builder setBucketBoundaries(java.util.List<java.lang.Double>)
40+
+++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions$Builder setRecordMinMax(boolean)

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusMetricReaderTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.opentelemetry.api.trace.Tracer;
2020
import io.opentelemetry.context.Scope;
2121
import io.opentelemetry.sdk.metrics.Aggregation;
22+
import io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions;
2223
import io.opentelemetry.sdk.metrics.InstrumentSelector;
2324
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
2425
import io.opentelemetry.sdk.metrics.View;
@@ -782,7 +783,12 @@ void exponentialHistogramBucketConversion() {
782783
.registerView(
783784
InstrumentSelector.builder().setName("my.exponential.histogram").build(),
784785
View.builder()
785-
.setAggregation(Aggregation.base2ExponentialBucketHistogram(160, otelScale))
786+
.setAggregation(
787+
Aggregation.base2ExponentialBucketHistogram(
788+
Base2ExponentialHistogramOptions.builder()
789+
.setMaxBuckets(160)
790+
.setMaxScale(otelScale)
791+
.build()))
786792
.build())
787793
.build()
788794
.meterBuilder("test")

sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactory.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Base2ExponentialBucketHistogramAggregationModel;
1111
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogramAggregationModel;
1212
import io.opentelemetry.sdk.metrics.Aggregation;
13+
import io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions;
14+
import io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions;
1315
import java.util.List;
1416

1517
final class AggregationFactory implements Factory<AggregationModel, Aggregation> {
@@ -37,15 +39,20 @@ public Aggregation create(AggregationModel model, DeclarativeConfigContext conte
3739
model.getBase2ExponentialBucketHistogram();
3840
if (exponentialBucketHistogram != null) {
3941
Integer maxScale = exponentialBucketHistogram.getMaxScale();
40-
if (maxScale == null) {
41-
maxScale = 20;
42-
}
4342
Integer maxSize = exponentialBucketHistogram.getMaxSize();
44-
if (maxSize == null) {
45-
maxSize = 160;
43+
Boolean recordMinMax = exponentialBucketHistogram.getRecordMinMax();
44+
Base2ExponentialHistogramOptions.Builder builder = Base2ExponentialHistogramOptions.builder();
45+
if (maxScale != null) {
46+
builder.setMaxScale(maxScale);
47+
}
48+
if (maxSize != null) {
49+
builder.setMaxBuckets(maxSize);
50+
}
51+
if (recordMinMax != null) {
52+
builder.setRecordMinMax(recordMinMax);
4653
}
4754
try {
48-
return Aggregation.base2ExponentialBucketHistogram(maxSize, maxScale);
55+
return Aggregation.base2ExponentialBucketHistogram(builder.build());
4956
} catch (IllegalArgumentException e) {
5057
throw new DeclarativeConfigException("Invalid exponential bucket histogram", e);
5158
}
@@ -54,11 +61,16 @@ public Aggregation create(AggregationModel model, DeclarativeConfigContext conte
5461
model.getExplicitBucketHistogram();
5562
if (explicitBucketHistogram != null) {
5663
List<Double> boundaries = explicitBucketHistogram.getBoundaries();
57-
if (boundaries == null) {
58-
return Aggregation.explicitBucketHistogram();
64+
Boolean recordMinMax = explicitBucketHistogram.getRecordMinMax();
65+
ExplicitBucketHistogramOptions.Builder builder = ExplicitBucketHistogramOptions.builder();
66+
if (boundaries != null) {
67+
builder.setBucketBoundaries(boundaries);
68+
}
69+
if (recordMinMax != null) {
70+
builder.setRecordMinMax(recordMinMax);
5971
}
6072
try {
61-
return Aggregation.explicitBucketHistogram(boundaries);
73+
return Aggregation.explicitBucketHistogram(builder.build());
6274
} catch (IllegalArgumentException e) {
6375
throw new DeclarativeConfigException("Invalid explicit bucket histogram", e);
6476
}

sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/metric/viewconfig/ViewConfig.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException;
1212
import io.opentelemetry.sdk.metrics.Aggregation;
13+
import io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions;
14+
import io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions;
1315
import io.opentelemetry.sdk.metrics.InstrumentSelector;
1416
import io.opentelemetry.sdk.metrics.InstrumentSelectorBuilder;
1517
import io.opentelemetry.sdk.metrics.InstrumentType;
@@ -203,7 +205,8 @@ static Aggregation toAggregation(String aggregationName, Map<String, Object> agg
203205
if (Aggregation.explicitBucketHistogram().equals(aggregation)) {
204206
List<Double> bucketBoundaries = getBucketBoundaries(aggregationArgs);
205207
if (bucketBoundaries != null) {
206-
return Aggregation.explicitBucketHistogram(bucketBoundaries);
208+
return Aggregation.explicitBucketHistogram(
209+
ExplicitBucketHistogramOptions.builder().setBucketBoundaries(bucketBoundaries).build());
207210
}
208211
}
209212
if (Aggregation.base2ExponentialBucketHistogram().equals(aggregation)) {
@@ -215,7 +218,8 @@ static Aggregation toAggregation(String aggregationName, Map<String, Object> agg
215218
}
216219
// TODO: support configuring max_scale
217220
if (maxBuckets != null) {
218-
return Aggregation.base2ExponentialBucketHistogram(maxBuckets, 20);
221+
return Aggregation.base2ExponentialBucketHistogram(
222+
Base2ExponentialHistogramOptions.builder().setMaxBuckets(maxBuckets).build());
219223
}
220224
}
221225
return aggregation;

sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactoryTest.java

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LastValueAggregationModel;
1616
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SumAggregationModel;
1717
import io.opentelemetry.sdk.metrics.Aggregation;
18+
import io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions;
19+
import io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions;
1820
import java.util.Arrays;
1921
import java.util.stream.Stream;
2022
import org.junit.jupiter.params.ParameterizedTest;
@@ -51,7 +53,11 @@ private static Stream<Arguments> createTestCases() {
5153
new Base2ExponentialBucketHistogramAggregationModel()
5254
.withMaxSize(2)
5355
.withMaxScale(2)),
54-
Aggregation.base2ExponentialBucketHistogram(2, 2)),
56+
Aggregation.base2ExponentialBucketHistogram(
57+
Base2ExponentialHistogramOptions.builder()
58+
.setMaxBuckets(2)
59+
.setMaxScale(2)
60+
.build())),
5561
Arguments.of(
5662
new AggregationModel()
5763
.withExplicitBucketHistogram(
@@ -62,6 +68,67 @@ private static Stream<Arguments> createTestCases() {
6268
.withExplicitBucketHistogram(
6369
new ExplicitBucketHistogramAggregationModel()
6470
.withBoundaries(Arrays.asList(1.0, 2.0))),
65-
Aggregation.explicitBucketHistogram(Arrays.asList(1.0, 2.0))));
71+
Aggregation.explicitBucketHistogram(
72+
ExplicitBucketHistogramOptions.builder()
73+
.setBucketBoundaries(Arrays.asList(1.0, 2.0))
74+
.build())),
75+
// Test recordMinMax parameter for explicit bucket histogram
76+
Arguments.of(
77+
new AggregationModel()
78+
.withExplicitBucketHistogram(
79+
new ExplicitBucketHistogramAggregationModel()
80+
.withBoundaries(Arrays.asList(1.0, 2.0))
81+
.withRecordMinMax(true)),
82+
Aggregation.explicitBucketHistogram(
83+
ExplicitBucketHistogramOptions.builder()
84+
.setBucketBoundaries(Arrays.asList(1.0, 2.0))
85+
.setRecordMinMax(true)
86+
.build())),
87+
Arguments.of(
88+
new AggregationModel()
89+
.withExplicitBucketHistogram(
90+
new ExplicitBucketHistogramAggregationModel()
91+
.withBoundaries(Arrays.asList(1.0, 2.0))
92+
.withRecordMinMax(false)),
93+
Aggregation.explicitBucketHistogram(
94+
ExplicitBucketHistogramOptions.builder()
95+
.setBucketBoundaries(Arrays.asList(1.0, 2.0))
96+
.setRecordMinMax(false)
97+
.build())),
98+
Arguments.of(
99+
new AggregationModel()
100+
.withExplicitBucketHistogram(
101+
new ExplicitBucketHistogramAggregationModel()
102+
.withBoundaries(null)
103+
.withRecordMinMax(false)),
104+
Aggregation.explicitBucketHistogram(
105+
ExplicitBucketHistogramOptions.builder().setRecordMinMax(false).build())),
106+
// Test recordMinMax parameter for exponential bucket histogram
107+
Arguments.of(
108+
new AggregationModel()
109+
.withBase2ExponentialBucketHistogram(
110+
new Base2ExponentialBucketHistogramAggregationModel()
111+
.withMaxSize(2)
112+
.withMaxScale(2)
113+
.withRecordMinMax(true)),
114+
Aggregation.base2ExponentialBucketHistogram(
115+
Base2ExponentialHistogramOptions.builder()
116+
.setMaxBuckets(2)
117+
.setMaxScale(2)
118+
.setRecordMinMax(true)
119+
.build())),
120+
Arguments.of(
121+
new AggregationModel()
122+
.withBase2ExponentialBucketHistogram(
123+
new Base2ExponentialBucketHistogramAggregationModel()
124+
.withMaxSize(2)
125+
.withMaxScale(2)
126+
.withRecordMinMax(false)),
127+
Aggregation.base2ExponentialBucketHistogram(
128+
Base2ExponentialHistogramOptions.builder()
129+
.setMaxBuckets(2)
130+
.setMaxScale(2)
131+
.setRecordMinMax(false)
132+
.build())));
66133
}
67134
}

sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactoryTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.IncludeExcludeModel;
1515
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ViewStreamModel;
1616
import io.opentelemetry.sdk.metrics.Aggregation;
17+
import io.opentelemetry.sdk.metrics.ExplicitBucketHistogramOptions;
1718
import io.opentelemetry.sdk.metrics.View;
1819
import java.util.Arrays;
1920
import java.util.Collections;
@@ -43,7 +44,11 @@ void create() {
4344
.setAttributeFilter(
4445
IncludeExcludePredicate.createExactMatching(
4546
Arrays.asList("foo", "bar"), Collections.singletonList("baz")))
46-
.setAggregation(Aggregation.explicitBucketHistogram(Arrays.asList(1.0, 2.0)))
47+
.setAggregation(
48+
Aggregation.explicitBucketHistogram(
49+
ExplicitBucketHistogramOptions.builder()
50+
.setBucketBoundaries(Arrays.asList(1.0, 2.0))
51+
.build()))
4752
.build();
4853

4954
View view =

sdk/metrics/src/jmh/java/io/opentelemetry/sdk/metrics/internal/aggregator/HistogramAggregationParam.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ public enum HistogramAggregationParam {
1717
new DoubleExplicitBucketHistogramAggregator(
1818
ExplicitBucketHistogramUtils.createBoundaryArray(
1919
ExplicitBucketHistogramUtils.DEFAULT_HISTOGRAM_BUCKET_BOUNDARIES),
20+
/* recordMinMax= */ true,
2021
ExemplarReservoirFactory.noSamples(),
2122
IMMUTABLE_DATA)),
2223
EXPLICIT_SINGLE_BUCKET(
2324
new DoubleExplicitBucketHistogramAggregator(
2425
ExplicitBucketHistogramUtils.createBoundaryArray(Collections.emptyList()),
26+
/* recordMinMax= */ true,
2527
ExemplarReservoirFactory.noSamples(),
2628
IMMUTABLE_DATA)),
2729
EXPONENTIAL_SMALL_CIRCULAR_BUFFER(
2830
new DoubleBase2ExponentialHistogramAggregator(
29-
ExemplarReservoirFactory.noSamples(), 20, 0, IMMUTABLE_DATA)),
31+
ExemplarReservoirFactory.noSamples(), 20, 0, /* recordMinMax= */ true, IMMUTABLE_DATA)),
3032
EXPONENTIAL_CIRCULAR_BUFFER(
3133
new DoubleBase2ExponentialHistogramAggregator(
32-
ExemplarReservoirFactory.noSamples(), 160, 0, IMMUTABLE_DATA));
34+
ExemplarReservoirFactory.noSamples(), 160, 0, /* recordMinMax= */ true, IMMUTABLE_DATA));
3335

3436
private final Aggregator<?> aggregator;
3537

sdk/metrics/src/jmh/java/io/opentelemetry/sdk/metrics/internal/aggregator/HistogramCollectBenchmark.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.opentelemetry.api.metrics.DoubleHistogram;
1010
import io.opentelemetry.sdk.common.CompletableResultCode;
1111
import io.opentelemetry.sdk.metrics.Aggregation;
12+
import io.opentelemetry.sdk.metrics.Base2ExponentialHistogramOptions;
1213
import io.opentelemetry.sdk.metrics.ExemplarFilter;
1314
import io.opentelemetry.sdk.metrics.InstrumentType;
1415
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
@@ -113,7 +114,8 @@ public enum AggregationGenerator {
113114
EXPLICIT_BUCKET_HISTOGRAM(Aggregation.explicitBucketHistogram()),
114115
DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM(Aggregation.base2ExponentialBucketHistogram()),
115116
ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM(
116-
Aggregation.base2ExponentialBucketHistogram(160, 0));
117+
Aggregation.base2ExponentialBucketHistogram(
118+
Base2ExponentialHistogramOptions.builder().setMaxBuckets(160).setMaxScale(0).build()));
117119

118120
private final Aggregation aggregation;
119121

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/Aggregation.java

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.opentelemetry.sdk.metrics;
77

88
import io.opentelemetry.sdk.metrics.data.MetricDataType;
9+
import io.opentelemetry.sdk.metrics.internal.aggregator.ExplicitBucketHistogramUtils;
910
import io.opentelemetry.sdk.metrics.internal.view.Base2ExponentialHistogramAggregation;
1011
import io.opentelemetry.sdk.metrics.internal.view.DefaultAggregation;
1112
import io.opentelemetry.sdk.metrics.internal.view.DropAggregation;
@@ -64,9 +65,25 @@ static Aggregation explicitBucketHistogram() {
6465
*
6566
* @param bucketBoundaries A list of (inclusive) upper bounds for the histogram. Should be in
6667
* order from lowest to highest.
68+
* @deprecated Use {@link #explicitBucketHistogram(ExplicitBucketHistogramOptions)} instead.
6769
*/
70+
@Deprecated
6871
static Aggregation explicitBucketHistogram(List<Double> bucketBoundaries) {
69-
return ExplicitBucketHistogramAggregation.create(bucketBoundaries);
72+
return explicitBucketHistogram(
73+
ExplicitBucketHistogramOptions.builder().setBucketBoundaries(bucketBoundaries).build());
74+
}
75+
76+
/**
77+
* Aggregates measurements into an explicit bucket {@link MetricDataType#HISTOGRAM}.
78+
*
79+
* @param options histogram options
80+
*/
81+
static Aggregation explicitBucketHistogram(ExplicitBucketHistogramOptions options) {
82+
List<Double> boundaries = options.getBucketBoundaries();
83+
if (boundaries == null) {
84+
boundaries = ExplicitBucketHistogramUtils.DEFAULT_HISTOGRAM_BUCKET_BOUNDARIES;
85+
}
86+
return ExplicitBucketHistogramAggregation.create(boundaries, options.getRecordMinMax());
7087
}
7188

7289
/**
@@ -89,8 +106,25 @@ static Aggregation base2ExponentialBucketHistogram() {
89106
* accommodated. Setting maxScale may reduce the number of downscales. Additionally, the
90107
* performance of computing bucket index is improved when scale is {@code <= 0}.
91108
* @since 1.23.0
109+
* @deprecated Use {@link #base2ExponentialBucketHistogram(Base2ExponentialHistogramOptions)}
110+
* instead.
92111
*/
112+
@Deprecated
93113
static Aggregation base2ExponentialBucketHistogram(int maxBuckets, int maxScale) {
94-
return Base2ExponentialHistogramAggregation.create(maxBuckets, maxScale);
114+
return base2ExponentialBucketHistogram(
115+
Base2ExponentialHistogramOptions.builder()
116+
.setMaxBuckets(maxBuckets)
117+
.setMaxScale(maxScale)
118+
.build());
119+
}
120+
121+
/**
122+
* Aggregates measurements into a base-2 {@link MetricDataType#EXPONENTIAL_HISTOGRAM}.
123+
*
124+
* @param options histogram options
125+
*/
126+
static Aggregation base2ExponentialBucketHistogram(Base2ExponentialHistogramOptions options) {
127+
return Base2ExponentialHistogramAggregation.create(
128+
options.getMaxBuckets(), options.getMaxScale(), options.getRecordMinMax());
95129
}
96130
}

0 commit comments

Comments
 (0)