Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the OpenTelemetry SDK version to 1.37.0 #11066

Merged
merged 16 commits into from
Apr 10, 2024
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions

// this line is managed by .github/scripts/update-sdk-version.sh
val otelSdkVersion = "1.36.0"
val otelSdkVersion = "1.37.0"
val otelContribVersion = "1.34.0-alpha"
val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")

Expand Down
5 changes: 2 additions & 3 deletions examples/distro/agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ tasks {
// exclude known bootstrap dependencies - they can't appear in the inst/ directory
dependencies {
exclude("io.opentelemetry:opentelemetry-api")
exclude("io.opentelemetry:opentelemetry-api-events")
exclude("io.opentelemetry:opentelemetry-context")
// metrics advice API
exclude("io.opentelemetry:opentelemetry-extension-incubator")
// events API and metrics advice API
exclude("io.opentelemetry:opentelemetry-api-incubator")
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/distro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subprojects {
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
opentelemetrySdk : "1.36.0",
opentelemetrySdk : "1.37.0",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "2.3.0-SNAPSHOT",
Expand Down
5 changes: 2 additions & 3 deletions examples/distro/testing/agent-for-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ tasks {
// exclude known bootstrap dependencies - they can't appear in the inst/ directory
dependencies {
exclude("io.opentelemetry:opentelemetry-api")
exclude("io.opentelemetry:opentelemetry-api-events")
exclude("io.opentelemetry:opentelemetry-context")
// metrics advice API
exclude("io.opentelemetry:opentelemetry-extension-incubator")
// events API and metrics advice API
exclude("io.opentelemetry:opentelemetry-api-incubator")
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ version '1.0'
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
opentelemetrySdk : "1.36.0",
opentelemetrySdk : "1.37.0",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "2.3.0-SNAPSHOT",
Expand Down
2 changes: 1 addition & 1 deletion instrumentation-api-incubator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
api("io.opentelemetry.semconv:opentelemetry-semconv")
api("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
api(project(":instrumentation-api"))
implementation("io.opentelemetry:opentelemetry-extension-incubator")
implementation("io.opentelemetry:opentelemetry-api-incubator")

compileOnly("com.google.auto.value:auto-value-annotations")
annotationProcessor("com.google.auto.value:auto-value")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import static java.util.Arrays.asList;

import io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder;
import io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder;
import io.opentelemetry.api.metrics.LongHistogramBuilder;
import io.opentelemetry.api.metrics.LongUpDownCounterBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder;
import io.opentelemetry.semconv.ErrorAttributes;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.NetworkAttributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

package io.opentelemetry.instrumentation.api.incubator.semconv.rpc;

import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.semconv.NetworkAttributes;
import io.opentelemetry.semconv.ServerAttributes;
import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes;
Expand Down
2 changes: 1 addition & 1 deletion instrumentation-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ group = "io.opentelemetry.instrumentation"

dependencies {
api("io.opentelemetry:opentelemetry-api")
implementation("io.opentelemetry:opentelemetry-extension-incubator")
implementation("io.opentelemetry:opentelemetry-api-incubator")
implementation("io.opentelemetry.semconv:opentelemetry-semconv")
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
package io.opentelemetry.instrumentation.api.internal;

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.api.metrics.Meter;
import io.opentelemetry.context.Context;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.OperationListener;
import io.opentelemetry.instrumentation.api.instrumenter.OperationMetrics;
import java.util.function.BiConsumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;

import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.semconv.ErrorAttributes;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.NetworkAttributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
compileOnly("io.opentelemetry:opentelemetry-extension-incubator")
compileOnly("io.opentelemetry:opentelemetry-api-incubator")

library("io.micrometer:micrometer-core:1.5.0")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import io.micrometer.core.instrument.distribution.DistributionStatisticConfig;
import io.micrometer.core.instrument.util.TimeUtils;
import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import java.util.ArrayList;
import java.util.List;
import java.util.NavigableSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ public Span addEvent(
return this;
}

@Override
@CanIgnoreReturnValue
public Span addLink(SpanContext spanContext) {
agentSpan.addLink(Bridging.toAgent(spanContext));
return this;
}

@Override
@CanIgnoreReturnValue
public Span addLink(SpanContext spanContext, Attributes attributes) {
agentSpan.addLink(Bridging.toAgent(spanContext), Bridging.toAgent(attributes));
return this;
}

Comment on lines +103 to +116
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this deviates a bit from our usual approach of adding bridging for new methods in a subclass, but here it is much easier to do it the way it is so I think it is fine.

@Override
@CanIgnoreReturnValue
public Span setStatus(StatusCode status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ public ContextPropagators getPropagators() {
}

private static ApplicationMeterFactory getMeterFactory() {
// this class is defined in opentelemetry-api-1.32
// this class is defined in opentelemetry-api-1.37
ApplicationMeterFactory meterFactory =
getMeterFactory(
"io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_32.incubator.metrics.ApplicationMeterFactory132Incubator");
"io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics.ApplicationMeterFactory137Incubator");
if (meterFactory == null) {
// this class is defined in opentelemetry-api-1.32
meterFactory =
getMeterFactory(
"io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_32.incubator.metrics.ApplicationMeterFactory132Incubator");
}
if (meterFactory == null) {
// this class is defined in opentelemetry-api-1.32
meterFactory =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ plugins {

dependencies {
compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_31"))
compileOnly("io.opentelemetry:opentelemetry-extension-incubator")
compileOnly("io.opentelemetry:opentelemetry-api-incubator")

implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.27:javaagent"))

testImplementation("io.opentelemetry:opentelemetry-extension-incubator")
testImplementation("io.opentelemetry:opentelemetry-extension-incubator:1.31.0-alpha")
}

configurations.configureEach {
if (name == "testRuntimeClasspath" || name == "testCompileClasspath") {
resolutionStrategy {
force("io.opentelemetry:opentelemetry-api:1.31.0")
Comment on lines 18 to 21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laurit should we add something similar in all of the opentelemetry-api-* javaagent modules?

force("io.opentelemetry:opentelemetry-extension-incubator:1.31.0-alpha")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_31;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static java.util.Collections.singletonList;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

@AutoService(InstrumentationModule.class)
public class OpenTelemetryApiInstrumentationModule extends InstrumentationModule {
Expand All @@ -27,4 +29,10 @@ public boolean isIndyModule() {
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new OpenTelemetryInstrumentation());
}

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
return hasClassesNamed(
"application.io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ApplicationDoubleCounterBuilder131 extends ApplicationDoubleCounterB

@Override
public ExtendedDoubleCounterBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleCounterBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedDoubleCounterBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public LongGaugeBuilder ofLongs() {

@Override
public DoubleGauge build() {
io.opentelemetry.extension.incubator.metrics.DoubleGauge agentDoubleGauge =
((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder)
.build();
io.opentelemetry.api.incubator.metrics.DoubleGauge agentDoubleGauge =
((io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder).build();
return new DoubleGauge() {

@Override
Expand All @@ -50,7 +49,7 @@ public void set(double value, Attributes attributes) {

@Override
public ExtendedDoubleGaugeBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice(

@Override
public ExtendedDoubleHistogramBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ApplicationDoubleUpDownCounterBuilder131 extends ApplicationDoubleUp

@Override
public ExtendedDoubleUpDownCounterBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleUpDownCounterBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedDoubleUpDownCounterBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public DoubleCounterBuilder ofDoubles() {

@Override
public ExtendedLongCounterBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedLongCounterBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedLongCounterBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ final class ApplicationLongGaugeBuilder131 extends ApplicationLongGaugeBuilder

@Override
public LongGauge build() {
io.opentelemetry.extension.incubator.metrics.LongGauge agentLongGauge =
((io.opentelemetry.extension.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder)
.build();
io.opentelemetry.api.incubator.metrics.LongGauge agentLongGauge =
((io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder).build();
return new LongGauge() {
@Override
public void set(long value) {
Expand All @@ -43,7 +42,7 @@ public void set(long value, Attributes attributes) {

@Override
public ExtendedLongGaugeBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice(

@Override
public ExtendedLongHistogramBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public DoubleUpDownCounterBuilder ofDoubles() {

@Override
public ExtendedLongUpDownCounterBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

dependencies {
compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_32"))
compileOnly("io.opentelemetry:opentelemetry-extension-incubator")
compileOnly("io.opentelemetry:opentelemetry-api-incubator")

implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent"))
Expand All @@ -18,7 +18,7 @@ testing {
suites {
val incubatorTest by registering(JvmTestSuite::class) {
dependencies {
implementation("io.opentelemetry:opentelemetry-extension-incubator")
implementation("io.opentelemetry:opentelemetry-extension-incubator:1.32.0-alpha")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ExtendedDoubleHistogramBuilder setExplicitBucketBoundariesAdvice(

@Override
public ExtendedDoubleHistogramBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ExtendedLongHistogramBuilder setExplicitBucketBoundariesAdvice(

@Override
public ExtendedLongHistogramBuilder setAttributesAdvice(List<AttributeKey<?>> attributes) {
((io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder)
((io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder) agentBuilder)
.setAttributesAdvice(Bridging.toAgent(attributes));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id("otel.javaagent-instrumentation")
}

dependencies {
compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_37"))
compileOnly("io.opentelemetry:opentelemetry-api-incubator")

implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.27:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.31:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.32:javaagent"))
}

testing {
suites {
val incubatorTest by registering(JvmTestSuite::class) {
dependencies {
implementation("io.opentelemetry:opentelemetry-api-incubator:1.37.0-alpha")
}
}
}
}
Comment on lines +18 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be worth adding an oldAndNewIncubatorTest that pulls in both the -extension-incubator and -api-incubator artifacts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


tasks {
check {
dependsOn(testing.suites)
}
}
Loading
Loading