diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-metrics.txt b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-metrics.txt
index 9fa38661470..b6b2dfb647e 100644
--- a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-metrics.txt
+++ b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-metrics.txt
@@ -1,4 +1,35 @@
Comparing source compatibility of against
++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets (not serializable)
+ +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
+ +++ NEW SUPERCLASS: java.lang.Object
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.util.List getBucketCounts()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getOffset()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getScale()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) long getTotalCount()
++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.data.ExponentialHistogramData (not serializable)
+ +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
+ +++ NEW INTERFACE: io.opentelemetry.sdk.metrics.data.Data
+ +++ NEW SUPERCLASS: java.lang.Object
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.data.AggregationTemporality getAggregationTemporality()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.util.Collection getPoints()
++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData (not serializable)
+ +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
+ +++ NEW INTERFACE: io.opentelemetry.sdk.metrics.data.PointData
+ +++ NEW SUPERCLASS: java.lang.Object
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) long getCount()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.util.List getExemplars()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) double getMax()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) double getMin()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets getNegativeBuckets()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets getPositiveBuckets()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getScale()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) double getSum()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) long getZeroCount()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) boolean hasMax()
+ +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) boolean hasMin()
+*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.metrics.data.MetricData (not serializable)
+ === CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+ +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.metrics.data.ExponentialHistogramData getExponentialHistogramData()
*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.metrics.export.MetricReader (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW INTERFACE: java.io.Closeable
diff --git a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramBucketsMarshaler.java b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramBucketsMarshaler.java
index be88437d370..54bb047398c 100644
--- a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramBucketsMarshaler.java
+++ b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramBucketsMarshaler.java
@@ -10,7 +10,7 @@
import io.opentelemetry.exporter.internal.marshal.Serializer;
import io.opentelemetry.proto.metrics.v1.internal.ExponentialHistogramDataPoint;
import io.opentelemetry.sdk.internal.PrimitiveLongList;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramBuckets;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets;
import java.io.IOException;
import java.util.List;
diff --git a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramDataPointMarshaler.java b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramDataPointMarshaler.java
index 05f70010f78..e7ac8dcd68b 100644
--- a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramDataPointMarshaler.java
+++ b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramDataPointMarshaler.java
@@ -10,7 +10,7 @@
import io.opentelemetry.exporter.internal.marshal.Serializer;
import io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler;
import io.opentelemetry.proto.metrics.v1.internal.ExponentialHistogramDataPoint;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramPointData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
import java.io.IOException;
import java.util.Collection;
diff --git a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramMarshaler.java b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramMarshaler.java
index c07096ee8ae..9ad9b10296a 100644
--- a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramMarshaler.java
+++ b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/ExponentialHistogramMarshaler.java
@@ -10,7 +10,7 @@
import io.opentelemetry.exporter.internal.marshal.ProtoEnumInfo;
import io.opentelemetry.exporter.internal.marshal.Serializer;
import io.opentelemetry.proto.metrics.v1.internal.ExponentialHistogram;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramData;
import java.io.IOException;
/**
diff --git a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricMarshaler.java b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricMarshaler.java
index b09f59c18b3..6b91a407c5f 100644
--- a/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricMarshaler.java
+++ b/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricMarshaler.java
@@ -12,7 +12,6 @@
import io.opentelemetry.exporter.internal.marshal.Serializer;
import io.opentelemetry.proto.metrics.v1.internal.Metric;
import io.opentelemetry.sdk.metrics.data.MetricData;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
import java.io.IOException;
final class MetricMarshaler extends MarshalerWithSize {
@@ -57,8 +56,7 @@ static Marshaler create(MetricData metric) {
dataField = Metric.HISTOGRAM;
break;
case EXPONENTIAL_HISTOGRAM:
- dataMarshaler =
- ExponentialHistogramMarshaler.create(ExponentialHistogramData.fromMetricData(metric));
+ dataMarshaler = ExponentialHistogramMarshaler.create(metric.getExponentialHistogramData());
dataField = Metric.EXPONENTIAL_HISTOGRAM;
}
diff --git a/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricsRequestMarshalerTest.java b/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricsRequestMarshalerTest.java
index a80d2b0f52d..ea02d0c30e8 100644
--- a/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricsRequestMarshalerTest.java
+++ b/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricsRequestMarshalerTest.java
@@ -41,12 +41,16 @@
import io.opentelemetry.proto.metrics.v1.SummaryDataPoint;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
import io.opentelemetry.sdk.metrics.data.HistogramPointData;
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.metrics.data.PointData;
import io.opentelemetry.sdk.metrics.data.SummaryPointData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableDoubleExemplarData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableDoublePointData;
+import io.opentelemetry.sdk.metrics.internal.data.ImmutableExponentialHistogramData;
+import io.opentelemetry.sdk.metrics.internal.data.ImmutableExponentialHistogramPointData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableGaugeData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableHistogramData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableHistogramPointData;
@@ -57,9 +61,6 @@
import io.opentelemetry.sdk.metrics.internal.data.ImmutableSummaryData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableSummaryPointData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableValueAtQuantile;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramBuckets;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramPointData;
import io.opentelemetry.sdk.resources.Resource;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -415,7 +416,7 @@ void exponentialHistogramDataPoints() {
assertThat(
toExponentialHistogramDataPoints(
ImmutableList.of(
- ExponentialHistogramPointData.create(
+ ImmutableExponentialHistogramPointData.create(
0,
123.4,
1,
@@ -427,7 +428,7 @@ void exponentialHistogramDataPoints() {
456,
Attributes.empty(),
Collections.emptyList()),
- ExponentialHistogramPointData.create(
+ ImmutableExponentialHistogramPointData.create(
0,
123.4,
1,
@@ -827,10 +828,10 @@ void toProtoMetric_exponentialHistogram() {
"name",
"description",
"1",
- ExponentialHistogramData.create(
+ ImmutableExponentialHistogramData.create(
AggregationTemporality.CUMULATIVE,
singletonList(
- ExponentialHistogramPointData.create(
+ ImmutableExponentialHistogramPointData.create(
20,
123.4,
257,
diff --git a/exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Serializer.java b/exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Serializer.java
index 165776b4095..5053f9aedbd 100644
--- a/exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Serializer.java
+++ b/exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Serializer.java
@@ -37,7 +37,6 @@
import io.opentelemetry.sdk.metrics.data.PointData;
import io.opentelemetry.sdk.metrics.data.SummaryPointData;
import io.opentelemetry.sdk.metrics.data.ValueAtQuantile;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
import io.opentelemetry.sdk.resources.Resource;
import java.io.BufferedWriter;
import java.io.IOException;
@@ -646,7 +645,7 @@ static Collection extends PointData> getPoints(MetricData metricData) {
case HISTOGRAM:
return metricData.getHistogramData().getPoints();
case EXPONENTIAL_HISTOGRAM:
- return ExponentialHistogramData.fromMetricData(metricData).getPoints();
+ return metricData.getExponentialHistogramData().getPoints();
}
return Collections.emptyList();
}
diff --git a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramAssert.java b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramAssert.java
index 268fc672bef..9c5009a5674 100644
--- a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramAssert.java
+++ b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramAssert.java
@@ -6,8 +6,8 @@
package io.opentelemetry.sdk.testing.assertj;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramPointData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.AbstractIterableAssert;
import org.assertj.core.api.Assertions;
diff --git a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramBucketsAssert.java b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramBucketsAssert.java
index 28b0e345499..c78438fff64 100644
--- a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramBucketsAssert.java
+++ b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramBucketsAssert.java
@@ -5,7 +5,7 @@
package io.opentelemetry.sdk.testing.assertj;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramBuckets;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets;
import java.util.List;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
diff --git a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramPointDataAssert.java b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramPointDataAssert.java
index cd5680b5c5a..5dc4e42754e 100644
--- a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramPointDataAssert.java
+++ b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/ExponentialHistogramPointDataAssert.java
@@ -5,7 +5,7 @@
package io.opentelemetry.sdk.testing.assertj;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramPointData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
import org.assertj.core.api.Assertions;
/** Test assertions for {@link ExponentialHistogramPointData}. */
diff --git a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricAssertions.java b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricAssertions.java
index b096f8ef640..9cd30280583 100644
--- a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricAssertions.java
+++ b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricAssertions.java
@@ -6,9 +6,9 @@
package io.opentelemetry.sdk.testing.assertj;
import io.opentelemetry.sdk.metrics.data.ExemplarData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramBuckets;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
import io.opentelemetry.sdk.metrics.data.MetricData;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramBuckets;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramPointData;
import org.assertj.core.api.Assertions;
/** Test assertions for data heading to exporters within the Metrics SDK. */
diff --git a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricDataAssert.java b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricDataAssert.java
index d4e57b4c5a9..6c088c99a0d 100644
--- a/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricDataAssert.java
+++ b/sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/MetricDataAssert.java
@@ -8,7 +8,6 @@
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.metrics.data.MetricDataType;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
import io.opentelemetry.sdk.resources.Resource;
import org.assertj.core.api.AbstractAssert;
@@ -107,6 +106,6 @@ public ExponentialHistogramAssert hasExponentialHistogram() {
MetricDataType.EXPONENTIAL_HISTOGRAM,
actual.getType());
}
- return new ExponentialHistogramAssert(ExponentialHistogramData.fromMetricData(actual));
+ return new ExponentialHistogramAssert(actual.getExponentialHistogramData());
}
}
diff --git a/sdk/metrics-testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java b/sdk/metrics-testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java
index 2cf03935f71..ba76008a11b 100644
--- a/sdk/metrics-testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java
+++ b/sdk/metrics-testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java
@@ -13,9 +13,9 @@
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
import io.opentelemetry.sdk.metrics.data.MetricData;
+import io.opentelemetry.sdk.metrics.internal.data.ImmutableExponentialHistogramData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableGaugeData;
import io.opentelemetry.sdk.metrics.internal.data.ImmutableMetricData;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
import io.opentelemetry.sdk.resources.Resource;
import java.util.Collections;
import org.junit.jupiter.api.Test;
@@ -33,7 +33,7 @@ public class MetricAssertionsTest {
/* name= */ "exponential_histogram",
/* description= */ "description",
/* unit= */ "unit",
- ExponentialHistogramData.create(
+ ImmutableExponentialHistogramData.create(
AggregationTemporality.CUMULATIVE,
// Points
Collections.emptyList()));
@@ -45,7 +45,7 @@ public class MetricAssertionsTest {
/* name= */ "exponential_histogram_delta",
/* description= */ "description",
/* unit= */ "unit",
- ExponentialHistogramData.create(
+ ImmutableExponentialHistogramData.create(
AggregationTemporality.DELTA,
// Points
Collections.emptyList()));
diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/exponentialhistogram/ExponentialHistogramBuckets.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/ExponentialHistogramBuckets.java
similarity index 89%
rename from sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/exponentialhistogram/ExponentialHistogramBuckets.java
rename to sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/ExponentialHistogramBuckets.java
index 556ea311ca1..71ad13f899f 100644
--- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/exponentialhistogram/ExponentialHistogramBuckets.java
+++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/ExponentialHistogramBuckets.java
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-package io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram;
+package io.opentelemetry.sdk.metrics.data;
import java.util.List;
import javax.annotation.concurrent.Immutable;
@@ -20,8 +20,7 @@
* offset
is -3, the bucket lower bounds would be 0.125, 0.25, 0.5, 1.0, 2,0, etc. If
* offset
is +3, the bucket lower bounds would be 8.0, 16.0, 32.0, etc.
*
- *
This class is internal and is hence not for public use. Its APIs are unstable and can change - * at any time. + * @since 1.23.0 */ @Immutable public interface ExponentialHistogramBuckets { diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/ExponentialHistogramData.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/ExponentialHistogramData.java new file mode 100644 index 00000000000..68db6f5c6e5 --- /dev/null +++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/ExponentialHistogramData.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.sdk.metrics.data; + +import java.util.Collection; +import javax.annotation.concurrent.Immutable; + +/** + * A base-2 exponential histogram metric point, as defined by the OpenTelemetry Exponential + * Histogram specification. + * + *
Note: This is called "ExponentialHistogramData" to reflect which primitives are used to
+ * record it, however "ExponentialHistogram" is the equivalent OTLP type.
+ *
+ * @see Exponential
+ * Histogram Data Model
+ * @see ExponentialHistogramPointData
+ * @since 1.23.0
+ */
+@Immutable
+public interface ExponentialHistogramData extends Data AggregationTemporality describes if the aggregator reports delta changes since last report
+ * time, or cumulative changes since a fixed start time.
+ *
+ * @return the {@code AggregationTemporality} of this metric
+ */
+ AggregationTemporality getAggregationTemporality();
+
+ /**
+ * Returns the collection of {@link ExponentialHistogramPointData} for this histogram.
+ *
+ * @return the collection of data points for this histogram.
+ */
+ @Override
+ Collection The bucket boundaries are calculated using both the scale {@link #getScale()}, and the offset
* {@link ExponentialHistogramBuckets#getOffset()}.
*
- * See data
- * model.
- *
- * This class is internal and is hence not for public use. Its APIs are unstable and can change
- * at any time.
+ * @see Exponential
+ * Histogram Data Model
+ * @since 1.23.0
*/
@Immutable
public interface ExponentialHistogramPointData extends PointData {
- /**
- * Create an ExponentialHistogramPointData.
- *
- * @return an ExponentialHistogramPointData.
- */
- @SuppressWarnings("TooManyParameters")
- static ExponentialHistogramPointData create(
- int scale,
- double sum,
- long zeroCount,
- @Nullable Double min,
- @Nullable Double max,
- ExponentialHistogramBuckets positiveBuckets,
- ExponentialHistogramBuckets negativeBuckets,
- long startEpochNanos,
- long epochNanos,
- Attributes attributes,
- List See:
- * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#exponentialhistogram
+ * Auto value implementation of {@link ExponentialHistogramData}.
*
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
+@Immutable
@AutoValue
public abstract class ImmutableExponentialHistogramData implements ExponentialHistogramData {
private static final ExponentialHistogramData EMPTY =
- ExponentialHistogramData.create(AggregationTemporality.CUMULATIVE, Collections.emptyList());
+ create(AggregationTemporality.CUMULATIVE, Collections.emptyList());
public static ExponentialHistogramData empty() {
return EMPTY;
@@ -37,10 +37,4 @@ public static ExponentialHistogramData create(
}
ImmutableExponentialHistogramData() {}
-
- @Override
- public abstract AggregationTemporality getAggregationTemporality();
-
- @Override
- public abstract Collection This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
@AutoValue
@Immutable
-abstract class ImmutableExponentialHistogramPointData implements ExponentialHistogramPointData {
+public abstract class ImmutableExponentialHistogramPointData
+ implements ExponentialHistogramPointData {
ImmutableExponentialHistogramPointData() {}
@@ -30,7 +32,8 @@ abstract class ImmutableExponentialHistogramPointData implements ExponentialHist
*
* @return a DoubleExponentialHistogramPointData.
*/
- static ImmutableExponentialHistogramPointData create(
+ @SuppressWarnings("TooManyParameters")
+ public static ImmutableExponentialHistogramPointData create(
int scale,
double sum,
long zeroCount,
diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/ImmutableMetricData.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/ImmutableMetricData.java
index 070673180ce..037aba8867e 100644
--- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/ImmutableMetricData.java
+++ b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/ImmutableMetricData.java
@@ -9,6 +9,7 @@
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.metrics.data.Data;
import io.opentelemetry.sdk.metrics.data.DoublePointData;
+import io.opentelemetry.sdk.metrics.data.ExponentialHistogramData;
import io.opentelemetry.sdk.metrics.data.GaugeData;
import io.opentelemetry.sdk.metrics.data.HistogramData;
import io.opentelemetry.sdk.metrics.data.LongPointData;
@@ -16,7 +17,6 @@
import io.opentelemetry.sdk.metrics.data.MetricDataType;
import io.opentelemetry.sdk.metrics.data.SumData;
import io.opentelemetry.sdk.metrics.data.SummaryData;
-import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData;
import io.opentelemetry.sdk.resources.Resource;
import javax.annotation.concurrent.Immutable;
diff --git a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/exponentialhistogram/ExponentialHistogramData.java b/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/exponentialhistogram/ExponentialHistogramData.java
deleted file mode 100644
index 2cc0ff2826f..00000000000
--- a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/exponentialhistogram/ExponentialHistogramData.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram;
-
-import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
-import io.opentelemetry.sdk.metrics.data.Data;
-import io.opentelemetry.sdk.metrics.data.MetricData;
-import io.opentelemetry.sdk.metrics.data.MetricDataType;
-import java.util.Collection;
-import javax.annotation.concurrent.Immutable;
-
-/**
- * A base-2 exponential histogram metric point, as defined by the OpenTelemetry Exponential
- * Histogram specification.
- *
- * See {@link ExponentialHistogramPointData} for more information.
- *
- * See:
- * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#exponentialhistogram
- *
- * Note: This is called "ExponentialHistogramData" to reflect which primitives are used to
- * record it, however "ExponentialHistogram" is the equivalent OTLP type.
- *
- * This class is internal and is hence not for public use. Its APIs are unstable and can change
- * at any time.
- */
-@Immutable
-public interface ExponentialHistogramData extends Data AggregationTemporality describes if the aggregator reports delta changes since last report
- * time, or cumulative changes since a fixed start time.
- *
- * @return the {@code AggregationTemporality} of this metric
- */
- AggregationTemporality getAggregationTemporality();
-
- /**
- * Returns the collection of {@link ExponentialHistogramPointData} for this histogram.
- *
- * @return the collection of data points for this histogram.
- */
- @Override
- Collection