Update to OTel SDK 1.3.0
MODIFY
dependencyManagement/dependencyManagement.gradle.kts
dependencyManagement/dependencyManagement.gradle.kts
@@ -30,8 +30,8 @@ val DEPENDENCY_BOMS = listOf(
"com.fasterxml.jackson:jackson-bom:2.12.3",
"com.google.guava:guava-bom:30.1.1-jre",
"org.codehaus.groovy:groovy-bom:${groovyVersion}",
- "io.opentelemetry:opentelemetry-bom:1.2.0",
- "io.opentelemetry:opentelemetry-bom-alpha:1.2.0-alpha",
+ "io.opentelemetry:opentelemetry-bom:1.3.0",
+ "io.opentelemetry:opentelemetry-bom-alpha:1.3.0-alpha",
"org.junit:junit-bom:5.7.1"
)

MODIFY
instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/test/groovy/MeterTest.groovy
instrumentation/opentelemetry-api-metrics-1.0/javaagent/src/test/groovy/MeterTest.groovy
import static io.opentelemetry.sdk.metrics.data.MetricDataType.DOUBLE_GAUGE
import static io.opentelemetry.sdk.metrics.data.MetricDataType.DOUBLE_SUM
-import static io.opentelemetry.sdk.metrics.data.MetricDataType.LONG_GAUGE
-import static io.opentelemetry.sdk.metrics.data.MetricDataType.LONG_SUM
import static io.opentelemetry.sdk.metrics.data.MetricDataType.SUMMARY
import static java.util.concurrent.TimeUnit.SECONDS
@@ -62,10 +60,10 @@ class MeterTest extends AgentInstrumentationSpecification {
where:
builderMethod | bind | value1 | value2 | expectedValue | expectedType
- "longCounterBuilder" | false | 5 | 6 | 11 | LONG_SUM
- "longCounterBuilder" | true | 5 | 6 | 11 | LONG_SUM
- "longUpDownCounterBuilder" | false | 5 | 6 | 11 | LONG_SUM
- "longUpDownCounterBuilder" | true | 5 | 6 | 11 | LONG_SUM
+ "longCounterBuilder" | false | 5 | 6 | 11 | DOUBLE_SUM
+ "longCounterBuilder" | true | 5 | 6 | 11 | DOUBLE_SUM
+ "longUpDownCounterBuilder" | false | 5 | 6 | 11 | DOUBLE_SUM
+ "longUpDownCounterBuilder" | true | 5 | 6 | 11 | DOUBLE_SUM
"doubleCounterBuilder" | false | 5.5 | 6.6 | 12.1 | DOUBLE_SUM
"doubleCounterBuilder" | true | 5.5 | 6.6 | 12.1 | DOUBLE_SUM
"doubleUpDownCounterBuilder" | false | 5.5 | 6.6 | 12.1 | DOUBLE_SUM
@@ -183,7 +181,6 @@ class MeterTest extends AgentInstrumentationSpecification {
metricData.instrumentationLibraryInfo.version == "1.2.3"
points(metricData).size() == 1
def point = points(metricData).iterator().next()
- point.labels == Labels.of("q", "r")
if (builderMethod.startsWith("long")) {
point.value == 123
} else {
@@ -192,9 +189,9 @@ class MeterTest extends AgentInstrumentationSpecification {
where:
builderMethod | valueMethod | expectedType
- "longSumObserverBuilder" | "value" | LONG_SUM
- "longUpDownSumObserverBuilder" | "value" | LONG_SUM
- "longValueObserverBuilder" | "sum" | LONG_GAUGE
+ "longSumObserverBuilder" | "value" | DOUBLE_SUM
+ "longUpDownSumObserverBuilder" | "value" | DOUBLE_SUM
+ "longValueObserverBuilder" | "sum" | DOUBLE_GAUGE
"doubleSumObserverBuilder" | "value" | DOUBLE_SUM
"doubleUpDownSumObserverBuilder" | "value" | DOUBLE_SUM
"doubleValueObserverBuilder" | "sum" | DOUBLE_GAUGE
@@ -228,12 +225,11 @@ class MeterTest extends AgentInstrumentationSpecification {
metricData != null
metricData.description == "d"
metricData.unit == "u"
- metricData.type == LONG_SUM
+ metricData.type == DOUBLE_SUM
metricData.instrumentationLibraryInfo.name == instrumentationName
metricData.instrumentationLibraryInfo.version == "1.2.3"
points(metricData).size() == 1
def point = points(metricData).iterator().next()
- point.labels == Labels.of("q", "r")
point.value == 11
def metricData2 = findMetric(instrumentationName, "test2")
@@ -245,7 +241,6 @@ class MeterTest extends AgentInstrumentationSpecification {
metricData2.instrumentationLibraryInfo.version == "1.2.3"
points(metricData2).size() == 1
def point2 = points(metricData2).iterator().next()
- point2.labels == Labels.of("q", "r")
point2.count == 2
point2.sum == 12.1
}

MODIFY
smoke-tests/src/test/java/io/opentelemetry/smoketest/LinuxTestContainerManager.java
smoke-tests/src/test/java/io/opentelemetry/smoketest/LinuxTestContainerManager.java
@@ -34,7 +34,7 @@ public class LinuxTestContainerManager extends AbstractTestContainerManager {
backend =
new GenericContainer<>(
DockerImageName.parse(
- "ghcr.io/open-telemetry/java-test-containers:smoke-fake-backend-20210324.684269693"))
+ "ghcr.io/open-telemetry/java-test-containers:smoke-fake-backend-20210611.927888723"))
.withExposedPorts(BACKEND_PORT)
.waitingFor(Wait.forHttp("/health").forPort(BACKEND_PORT))
.withNetwork(network)

MODIFY
smoke-tests/src/test/java/io/opentelemetry/smoketest/windows/WindowsTestContainerManager.java
smoke-tests/src/test/java/io/opentelemetry/smoketest/windows/WindowsTestContainerManager.java
@@ -77,7 +77,7 @@ public class WindowsTestContainerManager extends AbstractTestContainerManager {
.exec()
.getId();
- String backendSuffix = "-windows-20210427.788400024";
+ String backendSuffix = "-windows-20210611.927888723";
String backendImageName =
"ghcr.io/open-telemetry/java-test-containers:smoke-fake-backend" + backendSuffix;

MODIFY
testing-common/src/main/java/io/opentelemetry/javaagent/testing/common/AgentTestingExporterAccess.java
testing-common/src/main/java/io/opentelemetry/javaagent/testing/common/AgentTestingExporterAccess.java
@@ -29,15 +29,15 @@ import io.opentelemetry.proto.common.v1.ArrayValue;
import io.opentelemetry.proto.common.v1.InstrumentationLibrary;
import io.opentelemetry.proto.common.v1.KeyValue;
import io.opentelemetry.proto.common.v1.StringKeyValue;
-import io.opentelemetry.proto.metrics.v1.DoubleDataPoint;
-import io.opentelemetry.proto.metrics.v1.DoubleHistogramDataPoint;
-import io.opentelemetry.proto.metrics.v1.DoubleSum;
-import io.opentelemetry.proto.metrics.v1.DoubleSummaryDataPoint;
+import io.opentelemetry.proto.metrics.v1.HistogramDataPoint;
import io.opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics;
import io.opentelemetry.proto.metrics.v1.IntDataPoint;
import io.opentelemetry.proto.metrics.v1.IntSum;
import io.opentelemetry.proto.metrics.v1.Metric;
+import io.opentelemetry.proto.metrics.v1.NumberDataPoint;
import io.opentelemetry.proto.metrics.v1.ResourceMetrics;
+import io.opentelemetry.proto.metrics.v1.Sum;
+import io.opentelemetry.proto.metrics.v1.SummaryDataPoint;
import io.opentelemetry.proto.resource.v1.Resource;
import io.opentelemetry.proto.trace.v1.InstrumentationLibrarySpans;
import io.opentelemetry.proto.trace.v1.ResourceSpans;
@@ -274,15 +274,14 @@ public final class AgentTestingExporterAccess {
metric.getDescription(),
metric.getUnit(),
LongGaugeData.create(getIntPoints(metric.getIntGauge().getDataPointsList())));
- case DOUBLE_GAUGE:
+ case GAUGE:
return MetricData.createDoubleGauge(
resource,
instrumentationLibraryInfo,
metric.getName(),
metric.getDescription(),
metric.getUnit(),
- DoubleGaugeData.create(
- getDoublePointDatas(metric.getDoubleGauge().getDataPointsList())));
+ DoubleGaugeData.create(getDoublePointDatas(metric.getGauge().getDataPointsList())));
case INT_SUM:
IntSum intSum = metric.getIntSum();
return MetricData.createLongSum(
@@ -295,8 +294,8 @@ public final class AgentTestingExporterAccess {
intSum.getIsMonotonic(),
getTemporality(intSum.getAggregationTemporality()),
getIntPoints(metric.getIntSum().getDataPointsList())));
- case DOUBLE_SUM:
- DoubleSum doubleSum = metric.getDoubleSum();
+ case SUM:
+ Sum doubleSum = metric.getSum();
return MetricData.createDoubleSum(
resource,
instrumentationLibraryInfo,
@@ -306,8 +305,8 @@ public final class AgentTestingExporterAccess {
DoubleSumData.create(
doubleSum.getIsMonotonic(),
getTemporality(doubleSum.getAggregationTemporality()),
- getDoublePointDatas(metric.getDoubleSum().getDataPointsList())));
- case DOUBLE_HISTOGRAM:
+ getDoublePointDatas(metric.getSum().getDataPointsList())));
+ case HISTOGRAM:
return MetricData.createDoubleHistogram(
resource,
instrumentationLibraryInfo,
@@ -315,9 +314,9 @@ public final class AgentTestingExporterAccess {
metric.getDescription(),
metric.getUnit(),
DoubleHistogramData.create(
- getTemporality(metric.getDoubleHistogram().getAggregationTemporality()),
- getDoubleHistogramDataPoints(metric.getDoubleHistogram().getDataPointsList())));
- case DOUBLE_SUMMARY:
+ getTemporality(metric.getHistogram().getAggregationTemporality()),
+ getDoubleHistogramDataPoints(metric.getHistogram().getDataPointsList())));
+ case SUMMARY:
return MetricData.createDoubleSummary(
resource,
instrumentationLibraryInfo,
@@ -325,7 +324,7 @@ public final class AgentTestingExporterAccess {
metric.getDescription(),
metric.getUnit(),
DoubleSummaryData.create(
- getDoubleSummaryDataPoints(metric.getDoubleSummary().getDataPointsList())));
+ getDoubleSummaryDataPoints(metric.getSummary().getDataPointsList())));
default:
throw new AssertionError("Unexpected metric data: " + metric.getDataCase());
}
@@ -351,20 +350,31 @@ public final class AgentTestingExporterAccess {
.collect(toList());
}
- private static List<DoublePointData> getDoublePointDatas(List<DoubleDataPoint> points) {
+ private static List<DoublePointData> getDoublePointDatas(List<NumberDataPoint> points) {
return points.stream()
.map(
- point ->
- DoublePointData.create(
+ point -> {
+ final double value;
+ switch (point.getValueCase()) {
+ case AS_INT:
+ value = point.getAsInt();
+ break;
+ case AS_DOUBLE:
+ default:
+ value = point.getAsDouble();
+ break;
+ }
+ return DoublePointData.create(
point.getStartTimeUnixNano(),
point.getTimeUnixNano(),
createLabels(point.getLabelsList()),
- point.getValue()))
+ value);
+ })
.collect(toList());
}
private static Collection<DoubleHistogramPointData> getDoubleHistogramDataPoints(
- List<DoubleHistogramDataPoint> dataPointsList) {
+ List<HistogramDataPoint> dataPointsList) {
return dataPointsList.stream()
.map(
point ->
@@ -379,7 +389,7 @@ public final class AgentTestingExporterAccess {
}
private static Collection<DoubleSummaryPointData> getDoubleSummaryDataPoints(
- List<DoubleSummaryDataPoint> dataPointsList) {
+ List<SummaryDataPoint> dataPointsList) {
return dataPointsList.stream()
.map(
point ->
@@ -393,7 +403,7 @@ public final class AgentTestingExporterAccess {
.collect(toList());
}
- private static List<ValueAtPercentile> getValues(DoubleSummaryDataPoint point) {
+ private static List<ValueAtPercentile> getValues(SummaryDataPoint point) {
return point.getQuantileValuesList().stream()
.map(v -> ValueAtPercentile.create(v.getQuantile(), v.getValue()))
.collect(Collectors.toList());

Update to OTel SDK 1.3.0 (#3253)