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 in 1.x branch #11118

Merged
merged 4 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")

// Need both BOM and groovy jars
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.35.0",
opentelemetrySdk : "1.37.0",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.33.1",
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.35.0",
opentelemetrySdk : "1.37.0",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.33.1",
Expand Down
2 changes: 1 addition & 1 deletion instrumentation-api-semconv/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.semconv:opentelemetry-semconv")
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,12 +7,12 @@

import static java.util.Arrays.asList;

import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.api.incubator.metrics.ExtendedLongHistogramBuilder;
import io.opentelemetry.api.incubator.metrics.ExtendedLongUpDownCounterBuilder;
import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.api.metrics.LongHistogramBuilder;
import io.opentelemetry.api.metrics.LongUpDownCounterBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
import io.opentelemetry.semconv.SemanticAttributes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.api.metrics.Meter;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import java.util.List;

final class HttpMetricsUtil {
Expand All @@ -24,10 +23,7 @@ static DoubleHistogramBuilder createStableDurationHistogramBuilder(
DoubleHistogramBuilder durationBuilder =
meter.histogramBuilder(name).setUnit("s").setDescription(description);
// don't set custom buckets if milliseconds are still used
if (durationBuilder instanceof ExtendedDoubleHistogramBuilder) {
((ExtendedDoubleHistogramBuilder) durationBuilder)
.setExplicitBucketBoundariesAdvice(DURATION_SECONDS_BUCKETS);
}
durationBuilder.setExplicitBucketBoundariesAdvice(DURATION_SECONDS_BUCKETS);
return durationBuilder;
}

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

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.semconv.SemanticAttributes;
import java.util.ArrayList;
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")

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 @@ -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 @@ -42,3 +42,12 @@ dependencies {
// @WithSpan annotation is used to generate spans in ContextBridgeTest
testImplementation(project(":instrumentation-annotations"))
}

configurations.configureEach {
if (name == "testRuntimeClasspath" || name == "testCompileClasspath") {
resolutionStrategy {
// earliest version that works with out test harness
force("io.opentelemetry:opentelemetry-api:1.4.0")
}
}
}
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;
}

@Override
@CanIgnoreReturnValue
public Span setStatus(StatusCode status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ dependencies {
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent"))
}

configurations.configureEach {
if (name == "testRuntimeClasspath" || name == "testCompileClasspath") {
resolutionStrategy {
force("io.opentelemetry:opentelemetry-api:1.10.0")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.opentelemetry.api.metrics.ObservableLongUpDownCounter;
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import java.lang.reflect.Method;
import org.assertj.core.api.AbstractIterableAssert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -116,7 +117,7 @@ void observableLongCounter() throws InterruptedException {
.hasAttributesSatisfying(
equalTo(AttributeKey.stringKey("q"), "r"))))));

observableCounter.close();
close(observableCounter);

// sleep exporter interval
Thread.sleep(100);
Expand Down Expand Up @@ -192,7 +193,7 @@ void observableDoubleCounter() throws InterruptedException {
.hasAttributesSatisfying(
equalTo(AttributeKey.stringKey("q"), "r"))))));

observableCounter.close();
close(observableCounter);

// sleep exporter interval
Thread.sleep(100);
Expand Down Expand Up @@ -267,7 +268,7 @@ void observableLongUpDownCounter() throws InterruptedException {
.hasAttributesSatisfying(
equalTo(AttributeKey.stringKey("q"), "r"))))));

observableCounter.close();
close(observableCounter);

// sleep exporter interval
Thread.sleep(100);
Expand Down Expand Up @@ -343,7 +344,7 @@ void observableDoubleUpDownCounter() throws InterruptedException {
.hasAttributesSatisfying(
equalTo(AttributeKey.stringKey("q"), "r"))))));

observableCounter.close();
close(observableCounter);

// sleep exporter interval
Thread.sleep(100);
Expand Down Expand Up @@ -448,7 +449,7 @@ void longGauge() throws InterruptedException {
.hasAttributesSatisfying(
equalTo(AttributeKey.stringKey("q"), "r"))))));

observableGauge.close();
close(observableGauge);

// sleep exporter interval
Thread.sleep(100);
Expand Down Expand Up @@ -490,7 +491,7 @@ void doubleGauge() throws InterruptedException {
.hasAttributesSatisfying(
equalTo(AttributeKey.stringKey("q"), "r"))))));

observableGauge.close();
close(observableGauge);

// sleep exporter interval
Thread.sleep(100);
Expand All @@ -499,4 +500,14 @@ void doubleGauge() throws InterruptedException {

testing.waitAndAssertMetrics(instrumentationName, "test", AbstractIterableAssert::isEmpty);
}

private static void close(Object observableInstrument) {
// our bridge includes close method, although it was added in 1.12
try {
Method close = observableInstrument.getClass().getDeclaredMethod("close");
close.invoke(observableInstrument);
} catch (Exception exception) {
throw new IllegalStateException("Failed to call close", exception);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ dependencies {
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent"))
}

configurations.configureEach {
if (name == "testRuntimeClasspath" || name == "testCompileClasspath") {
resolutionStrategy {
force("io.opentelemetry:opentelemetry-api:1.15.0")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ dependencies {
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent"))
implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent"))
}

configurations.configureEach {
if (name == "testRuntimeClasspath" || name == "testCompileClasspath") {
resolutionStrategy {
force("io.opentelemetry:opentelemetry-api:1.27.0")
}
}
}
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")
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
Loading
Loading