Remove boxed primitives from aggregations (#5184)
This commit is contained in:
parent
8f5ddf26e5
commit
7bb2f0d832
|
@ -350,8 +350,10 @@ class MetricsRequestMarshalerTest {
|
|||
456,
|
||||
KV_ATTR,
|
||||
14.2,
|
||||
null,
|
||||
null,
|
||||
/* hasMin= */ false,
|
||||
0,
|
||||
/* hasMax= */ false,
|
||||
0,
|
||||
ImmutableList.of(1.0),
|
||||
ImmutableList.of(1L, 5L)),
|
||||
ImmutableHistogramPointData.create(
|
||||
|
@ -359,7 +361,9 @@ class MetricsRequestMarshalerTest {
|
|||
456,
|
||||
Attributes.empty(),
|
||||
15.3,
|
||||
/* hasMin= */ true,
|
||||
3.3,
|
||||
/* hasMax= */ true,
|
||||
12.0,
|
||||
ImmutableList.of(),
|
||||
ImmutableList.of(7L),
|
||||
|
@ -420,8 +424,10 @@ class MetricsRequestMarshalerTest {
|
|||
0,
|
||||
123.4,
|
||||
1,
|
||||
null,
|
||||
null,
|
||||
/* hasMin= */ false,
|
||||
0,
|
||||
/* hasMax= */ false,
|
||||
0,
|
||||
ImmutableExponentialHistogramBuckets.create(0, 0, Collections.emptyList()),
|
||||
ImmutableExponentialHistogramBuckets.create(0, 0, Collections.emptyList()),
|
||||
123,
|
||||
|
@ -432,7 +438,9 @@ class MetricsRequestMarshalerTest {
|
|||
0,
|
||||
123.4,
|
||||
1,
|
||||
/* hasMin= */ true,
|
||||
3.3,
|
||||
/* hasMax= */ true,
|
||||
80.1,
|
||||
ImmutableExponentialHistogramBuckets.create(
|
||||
0, 1, ImmutableList.of(1L, 0L, 2L)),
|
||||
|
@ -787,7 +795,9 @@ class MetricsRequestMarshalerTest {
|
|||
456,
|
||||
KV_ATTR,
|
||||
4.0,
|
||||
/* hasMin= */ true,
|
||||
1.0,
|
||||
/* hasMax= */ true,
|
||||
3.0,
|
||||
ImmutableList.of(),
|
||||
ImmutableList.of(33L)))))))
|
||||
|
@ -836,7 +846,9 @@ class MetricsRequestMarshalerTest {
|
|||
20,
|
||||
123.4,
|
||||
257,
|
||||
/* hasMin= */ true,
|
||||
20.1,
|
||||
/* hasMax= */ true,
|
||||
44.3,
|
||||
ImmutableExponentialHistogramBuckets.create(
|
||||
20, -1, ImmutableList.of(0L, 128L, 1L << 32)),
|
||||
|
|
|
@ -222,8 +222,10 @@ class SerializerTest {
|
|||
1633950672000000000L,
|
||||
Attributes.empty(),
|
||||
1.0,
|
||||
null,
|
||||
null,
|
||||
/* hasMin= */ false,
|
||||
0,
|
||||
/* hasMax= */ false,
|
||||
0,
|
||||
Collections.emptyList(),
|
||||
Collections.singletonList(2L),
|
||||
Collections.emptyList()))));
|
||||
|
@ -245,8 +247,10 @@ class SerializerTest {
|
|||
1633950672000000000L,
|
||||
Attributes.empty(),
|
||||
1.0,
|
||||
null,
|
||||
null,
|
||||
/* hasMin= */ false,
|
||||
0,
|
||||
/* hasMax= */ false,
|
||||
0,
|
||||
Collections.emptyList(),
|
||||
Collections.singletonList(2L),
|
||||
Collections.singletonList(
|
||||
|
@ -277,8 +281,10 @@ class SerializerTest {
|
|||
1633950672000000000L,
|
||||
Attributes.of(TYPE, "hs"),
|
||||
1.0,
|
||||
null,
|
||||
null,
|
||||
/* hasMin= */ false,
|
||||
0,
|
||||
/* hasMax= */ false,
|
||||
0,
|
||||
Collections.emptyList(),
|
||||
Collections.singletonList(2L),
|
||||
Collections.singletonList(
|
||||
|
|
|
@ -236,8 +236,10 @@ public final class MetricAdapter {
|
|||
endTimestamp,
|
||||
attributes,
|
||||
distribution.getSum(),
|
||||
null,
|
||||
null,
|
||||
/* hasMin= */ false,
|
||||
0,
|
||||
/* hasMax= */ false,
|
||||
0,
|
||||
mapBoundaries(distribution.getBucketOptions()),
|
||||
mapCounts(distribution.getBuckets()),
|
||||
mapExemplars(distribution.getBuckets())),
|
||||
|
|
|
@ -110,8 +110,10 @@ public final class DoubleBase2ExponentialHistogramAggregator
|
|||
scale,
|
||||
sum,
|
||||
zeroCount,
|
||||
this.count > 0 ? this.min : null,
|
||||
this.count > 0 ? this.max : null,
|
||||
this.count > 0,
|
||||
this.min,
|
||||
this.count > 0,
|
||||
this.max,
|
||||
resolveBuckets(this.positiveBuckets, scale, reset),
|
||||
resolveBuckets(this.negativeBuckets, scale, reset),
|
||||
startEpochNanos,
|
||||
|
|
|
@ -133,8 +133,10 @@ public final class DoubleExplicitBucketHistogramAggregator
|
|||
epochNanos,
|
||||
attributes,
|
||||
sum,
|
||||
this.count > 0 ? this.min : null,
|
||||
this.count > 0 ? this.max : null,
|
||||
this.count > 0,
|
||||
this.min,
|
||||
this.count > 0,
|
||||
this.max,
|
||||
boundaryList,
|
||||
PrimitiveLongList.wrap(Arrays.copyOf(counts, counts.length)),
|
||||
exemplars);
|
||||
|
|
|
@ -11,7 +11,6 @@ import io.opentelemetry.sdk.metrics.data.DoubleExemplarData;
|
|||
import io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets;
|
||||
import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +36,10 @@ public abstract class ImmutableExponentialHistogramPointData
|
|||
int scale,
|
||||
double sum,
|
||||
long zeroCount,
|
||||
@Nullable Double min,
|
||||
@Nullable Double max,
|
||||
boolean hasMin,
|
||||
double min,
|
||||
boolean hasMax,
|
||||
double max,
|
||||
ExponentialHistogramBuckets positiveBuckets,
|
||||
ExponentialHistogramBuckets negativeBuckets,
|
||||
long startEpochNanos,
|
||||
|
@ -56,10 +57,10 @@ public abstract class ImmutableExponentialHistogramPointData
|
|||
sum,
|
||||
count,
|
||||
zeroCount,
|
||||
min != null,
|
||||
min != null ? min : -1,
|
||||
max != null,
|
||||
max != null ? max : -1,
|
||||
hasMin,
|
||||
min,
|
||||
hasMax,
|
||||
max,
|
||||
positiveBuckets,
|
||||
negativeBuckets,
|
||||
exemplars);
|
||||
|
|
|
@ -13,7 +13,6 @@ import io.opentelemetry.sdk.metrics.data.HistogramPointData;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
/**
|
||||
|
@ -33,13 +32,16 @@ public abstract class ImmutableHistogramPointData implements HistogramPointData
|
|||
* @return a HistogramPointData.
|
||||
* @throws IllegalArgumentException if the given boundaries/counts were invalid
|
||||
*/
|
||||
@SuppressWarnings("TooManyParameters")
|
||||
public static ImmutableHistogramPointData create(
|
||||
long startEpochNanos,
|
||||
long epochNanos,
|
||||
Attributes attributes,
|
||||
double sum,
|
||||
@Nullable Double min,
|
||||
@Nullable Double max,
|
||||
boolean hasMin,
|
||||
double min,
|
||||
boolean hasMax,
|
||||
double max,
|
||||
List<Double> boundaries,
|
||||
List<Long> counts) {
|
||||
return create(
|
||||
|
@ -47,7 +49,9 @@ public abstract class ImmutableHistogramPointData implements HistogramPointData
|
|||
epochNanos,
|
||||
attributes,
|
||||
sum,
|
||||
hasMin,
|
||||
min,
|
||||
hasMax,
|
||||
max,
|
||||
boundaries,
|
||||
counts,
|
||||
|
@ -61,13 +65,16 @@ public abstract class ImmutableHistogramPointData implements HistogramPointData
|
|||
* @return a HistogramPointData.
|
||||
* @throws IllegalArgumentException if the given boundaries/counts were invalid
|
||||
*/
|
||||
@SuppressWarnings("TooManyParameters")
|
||||
public static ImmutableHistogramPointData create(
|
||||
long startEpochNanos,
|
||||
long epochNanos,
|
||||
Attributes attributes,
|
||||
double sum,
|
||||
@Nullable Double min,
|
||||
@Nullable Double max,
|
||||
boolean hasMin,
|
||||
double min,
|
||||
boolean hasMax,
|
||||
double max,
|
||||
List<Double> boundaries,
|
||||
List<Long> counts,
|
||||
List<DoubleExemplarData> exemplars) {
|
||||
|
@ -96,10 +103,10 @@ public abstract class ImmutableHistogramPointData implements HistogramPointData
|
|||
attributes,
|
||||
sum,
|
||||
totalCount,
|
||||
min != null,
|
||||
min != null ? min : -1,
|
||||
max != null,
|
||||
max != null ? max : -1,
|
||||
hasMin,
|
||||
min,
|
||||
hasMax,
|
||||
max,
|
||||
Collections.unmodifiableList(new ArrayList<>(boundaries)),
|
||||
Collections.unmodifiableList(new ArrayList<>(counts)),
|
||||
exemplars);
|
||||
|
|
|
@ -63,7 +63,9 @@ class ImmutableMetricDataTest {
|
|||
EPOCH_NANOS,
|
||||
Attributes.of(KEY, "value"),
|
||||
DOUBLE_VALUE,
|
||||
/* hasMin= */ true,
|
||||
DOUBLE_VALUE_MIN,
|
||||
/* hasMax= */ true,
|
||||
DOUBLE_VALUE_MAX,
|
||||
ImmutableList.of(1.0),
|
||||
ImmutableList.of(1L, 1L));
|
||||
|
@ -203,7 +205,9 @@ class ImmutableMetricDataTest {
|
|||
0,
|
||||
Attributes.empty(),
|
||||
0.0,
|
||||
/* hasMin= */ false,
|
||||
0.0,
|
||||
/* hasMax= */ false,
|
||||
0.0,
|
||||
ImmutableList.of(),
|
||||
ImmutableList.of()))
|
||||
|
@ -215,7 +219,9 @@ class ImmutableMetricDataTest {
|
|||
0,
|
||||
Attributes.empty(),
|
||||
0.0,
|
||||
/* hasMin= */ false,
|
||||
0.0,
|
||||
/* hasMax= */ false,
|
||||
0.0,
|
||||
ImmutableList.of(1.0, 1.0),
|
||||
ImmutableList.of(0L, 0L, 0L)))
|
||||
|
@ -227,7 +233,9 @@ class ImmutableMetricDataTest {
|
|||
0,
|
||||
Attributes.empty(),
|
||||
0.0,
|
||||
/* hasMin= */ false,
|
||||
0.0,
|
||||
/* hasMax= */ false,
|
||||
0.0,
|
||||
ImmutableList.of(Double.NEGATIVE_INFINITY),
|
||||
ImmutableList.of(0L, 0L)))
|
||||
|
|
|
@ -76,7 +76,9 @@ class DoubleExplicitBucketHistogramAggregatorTest {
|
|||
1,
|
||||
Attributes.empty(),
|
||||
2175,
|
||||
/* hasMin= */ true,
|
||||
5d,
|
||||
/* hasMax= */ true,
|
||||
2000d,
|
||||
boundariesList,
|
||||
Arrays.asList(1L, 1L, 1L, 1L)));
|
||||
|
@ -110,7 +112,9 @@ class DoubleExplicitBucketHistogramAggregatorTest {
|
|||
1,
|
||||
Attributes.empty(),
|
||||
0,
|
||||
/* hasMin= */ true,
|
||||
0.0,
|
||||
/* hasMax= */ true,
|
||||
0.0,
|
||||
boundariesList,
|
||||
Arrays.asList(1L, 0L, 0L, 0L),
|
||||
|
@ -131,7 +135,9 @@ class DoubleExplicitBucketHistogramAggregatorTest {
|
|||
1,
|
||||
Attributes.empty(),
|
||||
100,
|
||||
/* hasMin= */ true,
|
||||
100d,
|
||||
/* hasMax= */ true,
|
||||
100d,
|
||||
boundariesList,
|
||||
Arrays.asList(0L, 1L, 0L, 0L)));
|
||||
|
@ -145,7 +151,9 @@ class DoubleExplicitBucketHistogramAggregatorTest {
|
|||
1,
|
||||
Attributes.empty(),
|
||||
0,
|
||||
/* hasMin= */ true,
|
||||
0d,
|
||||
/* hasMax= */ true,
|
||||
0d,
|
||||
boundariesList,
|
||||
Arrays.asList(1L, 0L, 0L, 0L)));
|
||||
|
@ -191,7 +199,9 @@ class DoubleExplicitBucketHistogramAggregatorTest {
|
|||
1,
|
||||
Attributes.empty(),
|
||||
2,
|
||||
/* hasMin= */ true,
|
||||
2d,
|
||||
/* hasMax= */ true,
|
||||
2d,
|
||||
boundariesList,
|
||||
Arrays.asList(1L, 0L, 0L, 0L),
|
||||
|
@ -261,7 +271,9 @@ class DoubleExplicitBucketHistogramAggregatorTest {
|
|||
1,
|
||||
Attributes.empty(),
|
||||
1010000,
|
||||
/* hasMin= */ true,
|
||||
1d,
|
||||
/* hasMax= */ true,
|
||||
23d,
|
||||
boundariesList,
|
||||
Arrays.asList(50000L, 50000L, 0L, 0L)));
|
||||
|
|
|
@ -207,7 +207,9 @@ class MetricAssertionsTest {
|
|||
2,
|
||||
Attributes.empty(),
|
||||
15,
|
||||
/* hasMin= */ true,
|
||||
4.0,
|
||||
/* hasMax= */ true,
|
||||
7.0,
|
||||
Collections.singletonList(10.0),
|
||||
Arrays.asList(1L, 2L));
|
||||
|
@ -241,7 +243,9 @@ class MetricAssertionsTest {
|
|||
1,
|
||||
10.0,
|
||||
1,
|
||||
/* hasMin= */ true,
|
||||
2.0,
|
||||
/* hasMax= */ true,
|
||||
4.0,
|
||||
ImmutableExponentialHistogramBuckets.create(1, 10, Arrays.asList(1L, 2L)),
|
||||
ImmutableExponentialHistogramBuckets.create(1, 0, Collections.emptyList()),
|
||||
|
|
Loading…
Reference in New Issue