From 717fcf4b9490f3842996d60ab273f63122af9355 Mon Sep 17 00:00:00 2001 From: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Date: Fri, 9 Jun 2023 19:54:13 +0000 Subject: [PATCH 01/17] Update the OpenTelemetry SDK version to 1.27.0 --- dependencyManagement/build.gradle.kts | 2 +- examples/distro/build.gradle | 2 +- examples/extension/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index 6c38dbff5145..20975d48cf22 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -12,7 +12,7 @@ val dependencyVersions = hashMapOf() rootProject.extra["versions"] = dependencyVersions // this line is managed by .github/scripts/update-sdk-version.sh -val otelSdkVersion = "1.26.0" +val otelSdkVersion = "1.27.0" val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1") // Need both BOM and groovy jars diff --git a/examples/distro/build.gradle b/examples/distro/build.gradle index 0737cc204597..70a50c9ffd80 100644 --- a/examples/distro/build.gradle +++ b/examples/distro/build.gradle @@ -27,7 +27,7 @@ subprojects { ext { versions = [ // this line is managed by .github/scripts/update-sdk-version.sh - opentelemetrySdk : "1.26.0", + opentelemetrySdk : "1.27.0", // these lines are managed by .github/scripts/update-version.sh opentelemetryJavaagent : "1.27.0-SNAPSHOT", diff --git a/examples/extension/build.gradle b/examples/extension/build.gradle index 1064403a25f3..680e2f511533 100644 --- a/examples/extension/build.gradle +++ b/examples/extension/build.gradle @@ -23,7 +23,7 @@ version '1.0' ext { versions = [ // this line is managed by .github/scripts/update-sdk-version.sh - opentelemetrySdk : "1.26.0", + opentelemetrySdk : "1.27.0", // these lines are managed by .github/scripts/update-version.sh opentelemetryJavaagent : "1.27.0-SNAPSHOT", From 7c1c0a63df343f531f6042aa337a4c6e4a7399fe Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 9 Jun 2023 13:08:42 -0700 Subject: [PATCH 02/17] Fixes --- ...entelemetry.instrumentation.javaagent-testing.gradle.kts | 6 +----- examples/distro/agent/build.gradle | 1 - examples/distro/testing/agent-for-testing/build.gradle | 1 - instrumentation-annotations-support/build.gradle.kts | 1 - instrumentation-api/build.gradle.kts | 1 - .../java-util-logging/javaagent/build.gradle.kts | 1 - .../instrumentation/jul/JavaUtilLoggingHelper.java | 2 -- .../javaagent/build.gradle.kts | 1 - .../jbosslogmanager/appender/v1_1/LoggingEventMapper.java | 2 +- .../log4j/log4j-appender-1.2/javaagent/build.gradle.kts | 1 - .../instrumentation/log4j/appender/v1_2/LogEventMapper.java | 2 +- .../log4j/log4j-appender-2.17/javaagent/build.gradle.kts | 1 - .../log4j/log4j-appender-2.17/library/build.gradle.kts | 4 ---- .../log4j/appender/v2_17/internal/LogEventMapper.java | 2 +- .../logback/logback-appender-1.0/javaagent/build.gradle.kts | 2 -- .../logback/logback-appender-1.0/library/build.gradle.kts | 6 ------ .../logback/appender/v1_0/internal/LoggingEventMapper.java | 2 +- .../opentelemetry-api-logs-1.23/javaagent/build.gradle.kts | 4 +--- .../runtime-metrics-java8/library/build.gradle.kts | 1 - .../spring/spring-boot-autoconfigure/build.gradle.kts | 2 -- .../spring/starters/spring-boot-starter/build.gradle.kts | 1 - javaagent-tooling/build.gradle.kts | 4 ---- javaagent/build.gradle.kts | 6 ++---- opentelemetry-api-shaded-for-instrumenting/build.gradle.kts | 1 - testing-common/build.gradle.kts | 3 --- 25 files changed, 8 insertions(+), 50 deletions(-) diff --git a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts index f21aeffc9000..e58dceb7c9db 100644 --- a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts +++ b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts @@ -25,14 +25,10 @@ dependencies { compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") { // OpenTelemetry SDK is not needed for compilation exclude(group = "io.opentelemetry", module = "opentelemetry-sdk") - exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-metrics") - exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-logs") } compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") { // OpenTelemetry SDK is not needed for compilation exclude(group = "io.opentelemetry", module = "opentelemetry-sdk") - exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-metrics") - exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-logs") } // Used by byte-buddy but not brought in as a transitive dependency @@ -83,7 +79,7 @@ class JavaagentTestArgumentsProvider( "-Dotel.javaagent.testing.javaagent-jar-path=${agentShadowJar.absolutePath}", "-Dotel.javaagent.experimental.initializer.jar=${shadowJar.absolutePath}", "-Dotel.javaagent.testing.additional-library-ignores.enabled=false", - "-Dotel.javaagent.testing.fail-on-context-leak=${findProperty("failOnContextLeak") != false}", + "-Dotel.javaagent.testing.fail-on-context-leak=${findProperty("failOnContextLeak")!=false}", // prevent sporadic gradle deadlocks, see SafeLogger for more details "-Dotel.javaagent.testing.transform-safe-logging.enabled=true", // Reduce noise in assertion messages since we don't need to verify this in most tests. We check diff --git a/examples/distro/agent/build.gradle b/examples/distro/agent/build.gradle index f2d10b847995..dab66be0c884 100644 --- a/examples/distro/agent/build.gradle +++ b/examples/distro/agent/build.gradle @@ -74,7 +74,6 @@ tasks { dependencies { exclude("io.opentelemetry:opentelemetry-api") exclude("io.opentelemetry:opentelemetry-api-events") - exclude("io.opentelemetry:opentelemetry-api-logs") exclude("io.opentelemetry:opentelemetry-context") exclude("io.opentelemetry:opentelemetry-semconv") // metrics advice API diff --git a/examples/distro/testing/agent-for-testing/build.gradle b/examples/distro/testing/agent-for-testing/build.gradle index 72a54b0b62bc..47dae7e74019 100644 --- a/examples/distro/testing/agent-for-testing/build.gradle +++ b/examples/distro/testing/agent-for-testing/build.gradle @@ -71,7 +71,6 @@ tasks { dependencies { exclude("io.opentelemetry:opentelemetry-api") exclude("io.opentelemetry:opentelemetry-api-events") - exclude("io.opentelemetry:opentelemetry-api-logs") exclude("io.opentelemetry:opentelemetry-context") exclude("io.opentelemetry:opentelemetry-semconv") // metrics advice API diff --git a/instrumentation-annotations-support/build.gradle.kts b/instrumentation-annotations-support/build.gradle.kts index 4d9c296060b8..b64c96857519 100644 --- a/instrumentation-annotations-support/build.gradle.kts +++ b/instrumentation-annotations-support/build.gradle.kts @@ -17,6 +17,5 @@ dependencies { annotationProcessor("com.google.auto.value:auto-value") testImplementation(project(":testing-common")) - testImplementation("io.opentelemetry:opentelemetry-sdk-metrics") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") } diff --git a/instrumentation-api/build.gradle.kts b/instrumentation-api/build.gradle.kts index 572e5d91aff1..ec73a8ed0c2f 100644 --- a/instrumentation-api/build.gradle.kts +++ b/instrumentation-api/build.gradle.kts @@ -19,7 +19,6 @@ dependencies { annotationProcessor("com.google.auto.value:auto-value") testImplementation(project(":testing-common")) - testImplementation("io.opentelemetry:opentelemetry-sdk-metrics") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") testImplementation("org.junit-pioneer:junit-pioneer") diff --git a/instrumentation/java-util-logging/javaagent/build.gradle.kts b/instrumentation/java-util-logging/javaagent/build.gradle.kts index fd5f1a23bc5e..8169390cc18e 100644 --- a/instrumentation/java-util-logging/javaagent/build.gradle.kts +++ b/instrumentation/java-util-logging/javaagent/build.gradle.kts @@ -5,7 +5,6 @@ plugins { dependencies { compileOnly(project(":instrumentation:java-util-logging:shaded-stub-for-instrumenting")) - compileOnly("io.opentelemetry:opentelemetry-api-logs") compileOnly(project(":javaagent-bootstrap")) // ensure no cross interference diff --git a/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java b/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java index 68a1f32cf4b7..db9536afed34 100644 --- a/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java +++ b/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java @@ -80,8 +80,6 @@ private static void mapLogRecord(LogRecordBuilder builder, LogRecord logRecord) // throwable Throwable throwable = logRecord.getThrown(); if (throwable != null) { - // TODO (trask) extract method for recording exception into - // io.opentelemetry:opentelemetry-api-logs attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName()); attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage()); StringWriter writer = new StringWriter(); diff --git a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/build.gradle.kts b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/build.gradle.kts index f49b71cbad85..387c0000e008 100644 --- a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/build.gradle.kts +++ b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/build.gradle.kts @@ -14,7 +14,6 @@ muzzle { dependencies { library("org.jboss.logmanager:jboss-logmanager:1.1.0.GA") - compileOnly("io.opentelemetry:opentelemetry-api-logs") compileOnly(project(":javaagent-bootstrap")) // ensure no cross interference diff --git a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java index dc962bfc7797..72d513eee319 100644 --- a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java +++ b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java @@ -76,7 +76,7 @@ public void capture(Logger logger, ExtLogRecord record) { Throwable throwable = record.getThrown(); if (throwable != null) { // TODO (trask) extract method for recording exception into - // io.opentelemetry:opentelemetry-api-logs + // io.opentelemetry:opentelemetry-api attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName()); attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage()); StringWriter writer = new StringWriter(); diff --git a/instrumentation/log4j/log4j-appender-1.2/javaagent/build.gradle.kts b/instrumentation/log4j/log4j-appender-1.2/javaagent/build.gradle.kts index 67f2b2269ef0..0cf053ff67e3 100644 --- a/instrumentation/log4j/log4j-appender-1.2/javaagent/build.gradle.kts +++ b/instrumentation/log4j/log4j-appender-1.2/javaagent/build.gradle.kts @@ -16,7 +16,6 @@ dependencies { // 1.2 introduces MDC and there's no version earlier than 1.2.4 available library("log4j:log4j:1.2.4") - compileOnly("io.opentelemetry:opentelemetry-api-logs") compileOnly(project(":javaagent-bootstrap")) testImplementation("org.awaitility:awaitility") diff --git a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java index 543c24b9554c..12209df13ae5 100644 --- a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java +++ b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java @@ -82,7 +82,7 @@ public void capture(Category logger, Priority level, Object message, Throwable t // throwable if (throwable != null) { // TODO (trask) extract method for recording exception into - // io.opentelemetry:opentelemetry-api-logs + // io.opentelemetry:opentelemetry-api attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName()); attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage()); StringWriter writer = new StringWriter(); diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts b/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts index 7c21b004a49f..022c1c049eb9 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts @@ -16,7 +16,6 @@ val testLatestDeps = findProperty("testLatestDeps") as Boolean dependencies { library("org.apache.logging.log4j:log4j-core:2.17.0") - compileOnly("io.opentelemetry:opentelemetry-api-logs") compileOnly(project(":javaagent-bootstrap")) implementation(project(":instrumentation:log4j:log4j-appender-2.17:library")) diff --git a/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts b/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts index e56e2f8e6fa0..6a48ee260f96 100644 --- a/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts +++ b/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts @@ -3,11 +3,7 @@ plugins { } dependencies { - implementation("io.opentelemetry:opentelemetry-api-logs") - library("org.apache.logging.log4j:log4j-core:2.17.0") - testImplementation("io.opentelemetry:opentelemetry-sdk-logs") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") - testImplementation("io.opentelemetry:opentelemetry-sdk-logs-testing") } diff --git a/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/internal/LogEventMapper.java b/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/internal/LogEventMapper.java index 0cacf3aa5954..3b1aa702b104 100644 --- a/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/internal/LogEventMapper.java +++ b/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/internal/LogEventMapper.java @@ -186,7 +186,7 @@ public static AttributeKey getMapMessageAttributeKey(String key) { private static void setThrowable(AttributesBuilder attributes, Throwable throwable) { // TODO (trask) extract method for recording exception into - // io.opentelemetry:opentelemetry-api-logs + // io.opentelemetry:opentelemetry-api attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName()); attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage()); StringWriter writer = new StringWriter(); diff --git a/instrumentation/logback/logback-appender-1.0/javaagent/build.gradle.kts b/instrumentation/logback/logback-appender-1.0/javaagent/build.gradle.kts index 10106082a188..c69eba861c94 100644 --- a/instrumentation/logback/logback-appender-1.0/javaagent/build.gradle.kts +++ b/instrumentation/logback/logback-appender-1.0/javaagent/build.gradle.kts @@ -42,12 +42,10 @@ dependencies { } } - compileOnly("io.opentelemetry:opentelemetry-api-logs") compileOnly(project(":javaagent-bootstrap")) implementation(project(":instrumentation:logback:logback-appender-1.0:library")) - testImplementation("io.opentelemetry:opentelemetry-sdk-logs-testing") testImplementation("org.awaitility:awaitility") } diff --git a/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts b/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts index 0601acbd6cf8..dc625d36ad02 100644 --- a/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts +++ b/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts @@ -5,7 +5,6 @@ plugins { dependencies { compileOnly(project(":muzzle")) - implementation("io.opentelemetry:opentelemetry-api-logs") // pin the version strictly to avoid overriding by dependencyManagement versions compileOnly("ch.qos.logback:logback-classic") { @@ -36,8 +35,6 @@ dependencies { } } - testImplementation("io.opentelemetry:opentelemetry-sdk-logs") - testImplementation("io.opentelemetry:opentelemetry-sdk-logs-testing") testImplementation("io.opentelemetry:opentelemetry-sdk-testing") } @@ -63,9 +60,6 @@ testing { val slf4j2ApiTest by registering(JvmTestSuite::class) { dependencies { implementation(project(":instrumentation:logback:logback-appender-1.0:library")) - implementation("io.opentelemetry:opentelemetry-api-logs") - implementation("io.opentelemetry:opentelemetry-sdk-logs") - implementation("io.opentelemetry:opentelemetry-sdk-logs-testing") implementation("io.opentelemetry:opentelemetry-sdk-testing") if (latestDepTest) { diff --git a/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/internal/LoggingEventMapper.java b/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/internal/LoggingEventMapper.java index 147eabd19340..2393ae8e444c 100644 --- a/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/internal/LoggingEventMapper.java +++ b/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/internal/LoggingEventMapper.java @@ -178,7 +178,7 @@ public static AttributeKey getMdcAttributeKey(String key) { private static void setThrowable(AttributesBuilder attributes, Throwable throwable) { // TODO (trask) extract method for recording exception into - // io.opentelemetry:opentelemetry-api-logs + // io.opentelemetry:opentelemetry-api attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName()); attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage()); StringWriter writer = new StringWriter(); diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts index 3ce92db5b146..a6cf2d89e357 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts @@ -21,9 +21,7 @@ dependencies { // // and in the code "io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is used by // the agent (as those references will later be shaded) - compileOnly("io.opentelemetry:opentelemetry-api-logs") + compileOnly("io.opentelemetry:opentelemetry-api") compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "shadow")) implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) - - testImplementation("io.opentelemetry:opentelemetry-sdk-logs") } diff --git a/instrumentation/runtime-metrics/runtime-metrics-java8/library/build.gradle.kts b/instrumentation/runtime-metrics/runtime-metrics-java8/library/build.gradle.kts index 2691d6220fa0..4957c47b0e47 100644 --- a/instrumentation/runtime-metrics/runtime-metrics-java8/library/build.gradle.kts +++ b/instrumentation/runtime-metrics/runtime-metrics-java8/library/build.gradle.kts @@ -6,6 +6,5 @@ dependencies { implementation(project(":instrumentation-api")) implementation("io.opentelemetry:opentelemetry-extension-incubator") - testImplementation("io.opentelemetry:opentelemetry-sdk-metrics") testImplementation(project(":testing-common")) } diff --git a/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts b/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts index 664f7fc36e1c..8cd1255fd92c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts +++ b/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts @@ -37,7 +37,6 @@ dependencies { compileOnly("io.opentelemetry:opentelemetry-extension-trace-propagators") compileOnly("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator") compileOnly("io.opentelemetry:opentelemetry-exporter-logging") - compileOnly("io.opentelemetry:opentelemetry-exporter-otlp-logs") compileOnly("io.opentelemetry:opentelemetry-exporter-jaeger") compileOnly("io.opentelemetry:opentelemetry-exporter-otlp") compileOnly("io.opentelemetry:opentelemetry-exporter-zipkin") @@ -63,7 +62,6 @@ dependencies { testImplementation("io.opentelemetry:opentelemetry-extension-trace-propagators") testImplementation("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator") testImplementation("io.opentelemetry:opentelemetry-exporter-logging") - testImplementation("io.opentelemetry:opentelemetry-exporter-otlp-logs") testImplementation("io.opentelemetry:opentelemetry-exporter-jaeger") testImplementation("io.opentelemetry:opentelemetry-exporter-otlp") testImplementation("io.opentelemetry:opentelemetry-exporter-zipkin") diff --git a/instrumentation/spring/starters/spring-boot-starter/build.gradle.kts b/instrumentation/spring/starters/spring-boot-starter/build.gradle.kts index 5c00e886d886..cd1b989913f0 100644 --- a/instrumentation/spring/starters/spring-boot-starter/build.gradle.kts +++ b/instrumentation/spring/starters/spring-boot-starter/build.gradle.kts @@ -16,7 +16,6 @@ dependencies { api("io.opentelemetry:opentelemetry-api") api("io.opentelemetry:opentelemetry-exporter-logging") api("io.opentelemetry:opentelemetry-exporter-otlp") - api("io.opentelemetry:opentelemetry-exporter-otlp-logs") api("io.opentelemetry:opentelemetry-sdk") api(project(":instrumentation-annotations")) } diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index d07f43382cd6..2f3e19ee9f54 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -17,11 +17,8 @@ dependencies { implementation(project(":muzzle")) implementation("io.opentelemetry:opentelemetry-api") - implementation("io.opentelemetry:opentelemetry-api-logs") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") - implementation("io.opentelemetry:opentelemetry-sdk-metrics") - implementation("io.opentelemetry:opentelemetry-sdk-logs") implementation("io.opentelemetry:opentelemetry-extension-kotlin") implementation("io.opentelemetry:opentelemetry-extension-trace-propagators") // the incubator's ViewConfigCustomizer is used to support loading yaml-based metric views @@ -31,7 +28,6 @@ dependencies { implementation("io.opentelemetry:opentelemetry-exporter-jaeger") implementation("io.opentelemetry:opentelemetry-exporter-logging") implementation("io.opentelemetry:opentelemetry-exporter-otlp") - implementation("io.opentelemetry:opentelemetry-exporter-otlp-logs") implementation("io.opentelemetry:opentelemetry-exporter-logging-otlp") implementation("io.opentelemetry:opentelemetry-exporter-prometheus") diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts index 55ebb55a2e26..63d716a68d7c 100644 --- a/javaagent/build.gradle.kts +++ b/javaagent/build.gradle.kts @@ -35,7 +35,6 @@ listOf(baseJavaagentLibs, javaagentLibs).forEach { it.run { exclude("io.opentelemetry", "opentelemetry-api") exclude("io.opentelemetry", "opentelemetry-api-events") - exclude("io.opentelemetry", "opentelemetry-api-logs") exclude("io.opentelemetry", "opentelemetry-semconv") // metrics advice API exclude("io.opentelemetry", "opentelemetry-extension-incubator") @@ -48,9 +47,8 @@ val licenseReportDependencies by configurations.creating { dependencies { bootstrapLibs(project(":instrumentation-api")) - // opentelemetry-api is an api dependency of :instrumentation-api, but opentelemetry-api-(events|logs) is not + // opentelemetry-api is an api dependency of :instrumentation-api, but opentelemetry-api-events is not bootstrapLibs("io.opentelemetry:opentelemetry-api-events") - bootstrapLibs("io.opentelemetry:opentelemetry-api-logs") bootstrapLibs(project(":instrumentation-api-semconv")) bootstrapLibs(project(":instrumentation-annotations-support")) bootstrapLibs(project(":javaagent-bootstrap")) @@ -223,7 +221,7 @@ tasks { dependsOn(shadowJar, baseJavaagentJar) } - if (findProperty("removeJarVersionNumbers") == "true") { + if (findProperty("removeJarVersionNumbers")=="true") { withType().configureEach { archiveVersion.set("") } diff --git a/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts b/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts index 02f0a84e1ebd..72e627e7a5a4 100644 --- a/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts +++ b/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts @@ -38,7 +38,6 @@ val v1_15 by configurations.creating { dependencies { latestDeps("io.opentelemetry:opentelemetry-api") - latestDeps("io.opentelemetry:opentelemetry-api-logs") listOf("opentelemetry-api", "opentelemetry-context").forEach { v1_10Deps("io.opentelemetry:$it") { diff --git a/testing-common/build.gradle.kts b/testing-common/build.gradle.kts index 81482f5f5292..803e8f50d492 100644 --- a/testing-common/build.gradle.kts +++ b/testing-common/build.gradle.kts @@ -37,9 +37,6 @@ dependencies { api("io.opentelemetry:opentelemetry-semconv") api("io.opentelemetry:opentelemetry-sdk") api("io.opentelemetry:opentelemetry-sdk-testing") - api("io.opentelemetry:opentelemetry-sdk-logs-testing") - api("io.opentelemetry:opentelemetry-sdk-metrics") - api("io.opentelemetry:opentelemetry-sdk-logs") api(project(":instrumentation-api")) api("org.assertj:assertj-core") From ecbeff2b10d7bb1b462798a66de468677afb9eb4 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 9 Jun 2023 13:24:36 -0700 Subject: [PATCH 03/17] Remove messaging.destination.kind --- .../MessagingAttributesExtractor.java | 4 - .../messaging/MessagingAttributesGetter.java | 3 - .../MessagingAttributesExtractorTest.java | 6 - .../decorators/KafkaSpanDecorator.java | 1 - .../src/jms2Test/groovy/Jms2Test.groovy | 72 +++--- .../javaagent/src/test/groovy/Jms1Test.groovy | 102 ++++---- .../jms/v3_0/Jms3InstrumentationTest.java | 20 +- .../jms/JmsMessageAttributesGetter.java | 6 - .../jms/MessageWithDestination.java | 2 - .../kafka/internal/KafkaClientBaseTest.java | 3 - .../kafkaclients/v2_6/InterceptorsTest.java | 2 - .../kafkaclients/v2_6/WrapperTest.java | 2 - .../KafkaConsumerAttributesGetter.java | 6 - .../KafkaProducerAttributesGetter.java | 6 - .../KafkaReceiveAttributesGetter.java | 6 - .../groovy/KafkaStreamsDefaultTest.groovy | 28 +-- ...afkaStreamsSuppressReceiveSpansTest.groovy | 20 +- .../PulsarBatchMessagingAttributesGetter.java | 6 - .../PulsarMessagingAttributesGetter.java | 6 - .../pulsar/v2_8/PulsarClientTest.groovy | 222 +++++++++--------- .../RabbitChannelAttributesGetter.java | 6 - .../RabbitDeliveryAttributesGetter.java | 6 - .../RabbitReceiveAttributesGetter.java | 6 - .../src/test/groovy/RabbitMqTest.groovy | 47 ++-- .../test/groovy/ReactorRabbitMqTest.groovy | 3 +- .../kafka/v1_0/AbstractReactorKafkaTest.java | 3 - .../v4_8/RocketMqConsumerAttributeGetter.java | 6 - .../v4_8/RocketMqProducerAttributeGetter.java | 6 - .../v4_8/AbstractRocketMqClientTest.groovy | 13 +- ...ocketMqConsumerProcessAttributeGetter.java | 7 - ...ocketMqConsumerReceiveAttributeGetter.java | 7 - .../v5_0/RocketMqProducerAttributeGetter.java | 7 - ...RocketMqClientSuppressReceiveSpanTest.java | 8 - .../v5_0/AbstractRocketMqClientTest.java | 23 -- .../kafka/KafkaIntegrationTest.java | 2 - .../SpringIntegrationAndRabbitTest.groovy | 10 +- .../v4_1/SpringMessagingAttributesGetter.java | 6 - .../src/test/groovy/SpringListenerTest.groovy | 12 +- .../src/test/groovy/SpringTemplateTest.groovy | 45 ++-- ...ingListenerSuppressReceiveSpansTest.groovy | 4 +- .../jms/v6_0/SpringJmsListenerTest.java | 6 - .../spring/kafka/v2_7/SpringKafkaTest.java | 13 - ...ractSpringKafkaNoReceiveTelemetryTest.java | 9 - .../SpringRabbitMessageAttributesGetter.java | 5 - .../test/groovy/ContextPropagationTest.groovy | 43 ++-- .../kafka/v3_6/AbstractVertxKafkaTest.java | 3 - 46 files changed, 284 insertions(+), 545 deletions(-) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java index a3b3100bee9c..6cfe85d8465b 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java @@ -67,10 +67,6 @@ public static MessagingAttributesExtractorBuilder { @Nullable String getSystem(REQUEST request); - @Nullable - String getDestinationKind(REQUEST request); - @Nullable String getDestination(REQUEST request); diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java index 70b8094e9c24..d98fde90fb06 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java @@ -63,7 +63,6 @@ void shouldExtractAllAvailableAttributes( // then List, Object>> expectedEntries = new ArrayList<>(); expectedEntries.add(entry(SemanticAttributes.MESSAGING_SYSTEM, "myQueue")); - expectedEntries.add(entry(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic")); expectedEntries.add(entry(SemanticAttributes.MESSAGING_DESTINATION_NAME, expectedDestination)); if (temporary) { expectedEntries.add(entry(SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY, true)); @@ -118,11 +117,6 @@ public String getSystem(Map request) { return request.get("system"); } - @Override - public String getDestinationKind(Map request) { - return request.get("destinationKind"); - } - @Override public String getDestination(Map request) { return request.get("destination"); diff --git a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java index 04cdfd23e944..9efd4f9e7c2e 100644 --- a/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java +++ b/instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/KafkaSpanDecorator.java @@ -61,7 +61,6 @@ public void pre( super.pre(attributes, exchange, endpoint, camelDirection); attributes.put(SemanticAttributes.MESSAGING_OPERATION, "process"); - attributes.put(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"); Integer partition = exchange.getIn().getHeader(PARTITION, Integer.class); if (partition != null) { diff --git a/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy b/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy index ccf6b7a7fba3..222e5b91b814 100644 --- a/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy +++ b/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy @@ -69,7 +69,7 @@ class Jms2Test extends AgentInstrumentationSpecification { serverLocator.close() def connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, - new TransportConfiguration(InVMConnectorFactory.name)) + new TransportConfiguration(InVMConnectorFactory.name)) def connection = connectionFactory.createConnection() connection.start() @@ -81,7 +81,7 @@ class Jms2Test extends AgentInstrumentationSpecification { server.stop() } - def "sending a message to #destinationName #destinationType generates spans"() { + def "sending a message to #destinationName generates spans"() { setup: def producer = session.createProducer(destination) def consumer = session.createConsumer(destination) @@ -104,7 +104,7 @@ class Jms2Test extends AgentInstrumentationSpecification { name "producer parent" hasNoParent() } - producerSpan(it, 1, destinationType, destinationName, span(0)) + producerSpan(it, 1, destinationName, span(0)) producerSpanData = span(1) } @@ -113,7 +113,7 @@ class Jms2Test extends AgentInstrumentationSpecification { name "consumer parent" hasNoParent() } - consumerSpan(it, 1, destinationType, destinationName, messageId, "receive", span(0), producerSpanData) + consumerSpan(it, 1, destinationName, messageId, "receive", span(0), producerSpanData) } } @@ -122,14 +122,14 @@ class Jms2Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } - def "sending to a MessageListener on #destinationName #destinationType generates a span"() { + def "sending to a MessageListener on #destinationName generates a span"() { setup: def lock = new CountDownLatch(1) def messageRef = new AtomicReference() @@ -155,8 +155,8 @@ class Jms2Test extends AgentInstrumentationSpecification { name "parent" hasNoParent() } - producerSpan(it, 1, destinationType, destinationName, span(0)) - consumerSpan(it, 2, destinationType, destinationName, messageRef.get().getJMSMessageID(), "process", span(1)) + producerSpan(it, 1, destinationName, span(0)) + consumerSpan(it, 2, destinationName, messageRef.get().getJMSMessageID(), "process", span(1)) } } // This check needs to go after all traces have been accounted for @@ -167,14 +167,14 @@ class Jms2Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } - def "failing to receive message with receiveNoWait on #destinationName #destinationType works"() { + def "failing to receive message with receiveNoWait on #destinationName works"() { setup: def consumer = session.createConsumer(destination) @@ -190,12 +190,12 @@ class Jms2Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" } - def "failing to receive message with wait(timeout) on #destinationName #destinationType works"() { + def "failing to receive message with wait(timeout) on #destinationName works"() { setup: def consumer = session.createConsumer(destination) @@ -211,12 +211,12 @@ class Jms2Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" } - def "sending a message to #destinationName #destinationType with explicit destination propagates context"() { + def "sending a message to #destinationName with explicit destination propagates context"() { given: def producer = session.createProducer(null) def consumer = session.createConsumer(destination) @@ -244,8 +244,8 @@ class Jms2Test extends AgentInstrumentationSpecification { name "parent" hasNoParent() } - producerSpan(it, 1, destinationType, destinationName, span(0)) - consumerSpan(it, 2, destinationType, destinationName, messageRef.get().getJMSMessageID(), "process", span(1)) + producerSpan(it, 1, destinationName, span(0)) + consumerSpan(it, 2, destinationName, messageRef.get().getJMSMessageID(), "process", span(1)) } } // This check needs to go after all traces have been accounted for @@ -256,14 +256,14 @@ class Jms2Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } - static producerSpan(TraceAssert trace, int index, String destinationType, String destinationName, SpanData parentSpan = null) { + static producerSpan(TraceAssert trace, int index, String destinationName, SpanData parentSpan = null) { trace.span(index) { name destinationName + " send" kind PRODUCER @@ -275,7 +275,6 @@ class Jms2Test extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "jms" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType if (destinationName == "(temporary)") { "$SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY" true } @@ -287,7 +286,7 @@ class Jms2Test extends AgentInstrumentationSpecification { // passing messageId = null will verify message.id is not captured, // passing messageId = "" will verify message.id is captured (but won't verify anything about the value), // any other value for messageId will verify that message.id is captured and has that same value - static consumerSpan(TraceAssert trace, int index, String destinationType, String destinationName, String messageId, String operation, SpanData parentSpan, SpanData linkedSpan = null) { + static consumerSpan(TraceAssert trace, int index, String destinationName, String messageId, String operation, SpanData parentSpan, SpanData linkedSpan = null) { trace.span(index) { name destinationName + " " + operation kind CONSUMER @@ -304,7 +303,6 @@ class Jms2Test extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "jms" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType "$SemanticAttributes.MESSAGING_OPERATION" operation if (messageId != null) { //In some tests we don't know exact messageId, so we pass "" and verify just the existence of the attribute diff --git a/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy b/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy index 1dfb21e511d3..fe16b127a94a 100644 --- a/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy +++ b/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ + import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData @@ -16,11 +17,7 @@ import org.testcontainers.containers.output.Slf4jLogConsumer import spock.lang.Shared import spock.lang.Unroll -import javax.jms.Connection -import javax.jms.Message -import javax.jms.MessageListener -import javax.jms.Session -import javax.jms.TextMessage +import javax.jms.* import java.util.concurrent.CountDownLatch import java.util.concurrent.atomic.AtomicReference @@ -33,8 +30,8 @@ class Jms1Test extends AgentInstrumentationSpecification { private static final Logger logger = LoggerFactory.getLogger(Jms1Test) private static final GenericContainer broker = new GenericContainer("rmohr/activemq:latest") - .withExposedPorts(61616, 8161) - .withLogConsumer(new Slf4jLogConsumer(logger)) + .withExposedPorts(61616, 8161) + .withLogConsumer(new Slf4jLogConsumer(logger)) @Shared String messageText = "a message" @@ -56,7 +53,7 @@ class Jms1Test extends AgentInstrumentationSpecification { broker.stop() } - def "sending a message to #destinationName #destinationType generates spans"() { + def "sending a message to #destinationName generates spans"() { setup: def producer = session.createProducer(destination) def consumer = session.createConsumer(destination) @@ -79,7 +76,7 @@ class Jms1Test extends AgentInstrumentationSpecification { name "producer parent" hasNoParent() } - producerSpan(it, 1, destinationType, destinationName, span(0)) + producerSpan(it, 1, destinationName, span(0)) producerSpanData = span(1) } @@ -88,7 +85,7 @@ class Jms1Test extends AgentInstrumentationSpecification { name "consumer parent" hasNoParent() } - consumerSpan(it, 1, destinationType, destinationName, messageId, "receive", span(0), producerSpanData) + consumerSpan(it, 1, destinationName, messageId, "receive", span(0), producerSpanData) } } @@ -97,14 +94,14 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } - def "sending to a MessageListener on #destinationName #destinationType generates a span"() { + def "sending to a MessageListener on #destinationName generates a span"() { setup: def lock = new CountDownLatch(1) def messageRef = new AtomicReference() @@ -124,8 +121,8 @@ class Jms1Test extends AgentInstrumentationSpecification { expect: assertTraces(1) { trace(0, 2) { - producerSpan(it, 0, destinationType, destinationName) - consumerSpan(it, 1, destinationType, destinationName, messageRef.get().getJMSMessageID(), "process", span(0)) + producerSpan(it, 0, destinationName) + consumerSpan(it, 1, destinationName, messageRef.get().getJMSMessageID(), "process", span(0)) } } // This check needs to go after all traces have been accounted for @@ -136,14 +133,14 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } - def "failing to receive message with receiveNoWait on #destinationName #destinationType works"() { + def "failing to receive message with receiveNoWait on #destinationName works"() { setup: def consumer = session.createConsumer(destination) @@ -159,12 +156,12 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" } - def "failing to receive message with wait(timeout) on #destinationName #destinationType works"() { + def "failing to receive message with wait(timeout) on #destinationName works"() { setup: def consumer = session.createConsumer(destination) @@ -180,12 +177,12 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" } - def "sending a read-only message to #destinationName #destinationType fails"() { + def "sending a read-only message to #destinationName fails"() { setup: def producer = session.createProducer(destination) def consumer = session.createConsumer(destination) @@ -208,10 +205,10 @@ class Jms1Test extends AgentInstrumentationSpecification { // The consumer span will also not be linked to the parent. assertTraces(2) { trace(0, 1) { - producerSpan(it, 0, destinationType, destinationName) + producerSpan(it, 0, destinationName) } trace(1, 1) { - consumerSpan(it, 0, destinationType, destinationName, "", "receive", null) + consumerSpan(it, 0, destinationName, "", "receive", null) } } @@ -220,14 +217,14 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } - def "sending a message to #destinationName #destinationType with explicit destination propagates context"() { + def "sending a message to #destinationName with explicit destination propagates context"() { given: def producer = session.createProducer(null) def consumer = session.createConsumer(destination) @@ -255,8 +252,8 @@ class Jms1Test extends AgentInstrumentationSpecification { name "parent" hasNoParent() } - producerSpan(it, 1, destinationType, destinationName, span(0)) - consumerSpan(it, 2, destinationType, destinationName, messageRef.get().getJMSMessageID(), "process", span(1)) + producerSpan(it, 1, destinationName, span(0)) + consumerSpan(it, 2, destinationName, messageRef.get().getJMSMessageID(), "process", span(1)) } } // This check needs to go after all traces have been accounted for @@ -267,17 +264,16 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() where: - destination | destinationType | destinationName - session.createQueue("someQueue") | "queue" | "someQueue" - session.createTopic("someTopic") | "topic" | "someTopic" - session.createTemporaryQueue() | "queue" | "(temporary)" - session.createTemporaryTopic() | "topic" | "(temporary)" + destination | destinationName + session.createQueue("someQueue") | "someQueue" + session.createTopic("someTopic") | "someTopic" + session.createTemporaryQueue() | "(temporary)" + session.createTemporaryTopic() | "(temporary)" } def "capture message header as span attribute"() { setup: def destinationName = "someQueue" - def destinationType = "queue" def destination = session.createQueue(destinationName) def producer = session.createProducer(destination) def consumer = session.createConsumer(destination) @@ -303,7 +299,7 @@ class Jms1Test extends AgentInstrumentationSpecification { name "producer parent" hasNoParent() } - producerSpan(it, 1, destinationType, destinationName, span(0), true) + producerSpan(it, 1, destinationName, span(0), true) producerSpanData = span(1) } @@ -312,7 +308,7 @@ class Jms1Test extends AgentInstrumentationSpecification { name "consumer parent" hasNoParent() } - consumerSpan(it, 1, destinationType, destinationName, messageId, "receive", span(0), producerSpanData, true) + consumerSpan(it, 1, destinationName, messageId, "receive", span(0), producerSpanData, true) } } @@ -321,7 +317,7 @@ class Jms1Test extends AgentInstrumentationSpecification { consumer.close() } - static producerSpan(TraceAssert trace, int index, String destinationType, String destinationName, SpanData parentSpan = null, boolean testHeaders = false) { + static producerSpan(TraceAssert trace, int index, String destinationName, SpanData parentSpan = null, boolean testHeaders = false) { trace.span(index) { name destinationName + " send" kind PRODUCER @@ -333,7 +329,6 @@ class Jms1Test extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "jms" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType if (destinationName == "(temporary)") { "$SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY" true } @@ -349,7 +344,7 @@ class Jms1Test extends AgentInstrumentationSpecification { // passing messageId = null will verify message.id is not captured, // passing messageId = "" will verify message.id is captured (but won't verify anything about the value), // any other value for messageId will verify that message.id is captured and has that same value - static consumerSpan(TraceAssert trace, int index, String destinationType, String destinationName, String messageId, String operation, SpanData parentSpan, SpanData linkedSpan = null, boolean testHeaders = false) { + static consumerSpan(TraceAssert trace, int index, String destinationName, String messageId, String operation, SpanData parentSpan, SpanData linkedSpan = null, boolean testHeaders = false) { trace.span(index) { name destinationName + " " + operation kind CONSUMER @@ -366,7 +361,6 @@ class Jms1Test extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "jms" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType "$SemanticAttributes.MESSAGING_OPERATION" operation if (messageId != null) { //In some tests we don't know exact messageId, so we pass "" and verify just the existence of the attribute diff --git a/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java b/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java index c7f0bb0c7c86..190b69ddf597 100644 --- a/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java +++ b/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java @@ -108,7 +108,7 @@ static void tearDown() throws JMSException { @ArgumentsSource(DestinationsProvider.class) @ParameterizedTest void testMessageConsumer( - DestinationFactory destinationFactory, String destinationKind, boolean isTemporary) + DestinationFactory destinationFactory, boolean isTemporary) throws JMSException { // given @@ -148,7 +148,6 @@ void testMessageConsumer( equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, producerDestinationName), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, destinationKind), equalTo(SemanticAttributes.MESSAGING_MESSAGE_ID, messageId), messagingTempDestination(isTemporary))); @@ -167,7 +166,6 @@ void testMessageConsumer( equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, actualDestinationName), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, destinationKind), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo(SemanticAttributes.MESSAGING_MESSAGE_ID, messageId)))); } @@ -175,7 +173,7 @@ void testMessageConsumer( @ArgumentsSource(DestinationsProvider.class) @ParameterizedTest void testMessageListener( - DestinationFactory destinationFactory, String destinationKind, boolean isTemporary) + DestinationFactory destinationFactory, boolean isTemporary) throws Exception { // given @@ -218,7 +216,6 @@ void testMessageListener( equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, producerDestinationName), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, destinationKind), equalTo(SemanticAttributes.MESSAGING_MESSAGE_ID, messageId), messagingTempDestination(isTemporary)), span -> @@ -230,7 +227,6 @@ void testMessageListener( equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, actualDestinationName), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, destinationKind), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), equalTo(SemanticAttributes.MESSAGING_MESSAGE_ID, messageId)), span -> span.hasName("consumer").hasParent(trace.getSpan(2)))); @@ -259,7 +255,7 @@ void shouldNotEmitTelemetryOnEmptyReceive( @ArgumentsSource(DestinationsProvider.class) @ParameterizedTest void shouldCaptureMessageHeaders( - DestinationFactory destinationFactory, String destinationKind, boolean isTemporary) + DestinationFactory destinationFactory, boolean isTemporary) throws Exception { // given @@ -304,7 +300,6 @@ void shouldCaptureMessageHeaders( equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, producerDestinationName), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, destinationKind), equalTo(SemanticAttributes.MESSAGING_MESSAGE_ID, messageId), messagingTempDestination(isTemporary), equalTo( @@ -322,7 +317,6 @@ void shouldCaptureMessageHeaders( equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, actualDestinationName), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, destinationKind), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), equalTo(SemanticAttributes.MESSAGING_MESSAGE_ID, messageId), equalTo( @@ -367,10 +361,10 @@ public Stream provideArguments(ExtensionContext context) { DestinationFactory tempQueue = Session::createTemporaryQueue; return Stream.of( - arguments(topic, "topic", false), - arguments(queue, "queue", false), - arguments(tempTopic, "topic", true), - arguments(tempQueue, "queue", true)); + arguments(topic, false), + arguments(queue, false), + arguments(tempTopic, true), + arguments(tempQueue, true)); } } diff --git a/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsMessageAttributesGetter.java b/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsMessageAttributesGetter.java index 96310c187f56..93c854bfb3f9 100644 --- a/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsMessageAttributesGetter.java +++ b/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsMessageAttributesGetter.java @@ -23,12 +23,6 @@ public String getSystem(MessageWithDestination messageWithDestination) { return "jms"; } - @Nullable - @Override - public String getDestinationKind(MessageWithDestination messageWithDestination) { - return messageWithDestination.destinationKind(); - } - @Nullable @Override public String getDestination(MessageWithDestination messageWithDestination) { diff --git a/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java b/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java index 4f1367abfbbc..2a6e0066d073 100644 --- a/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java +++ b/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java @@ -17,8 +17,6 @@ public abstract class MessageWithDestination { public abstract String destinationName(); - public abstract String destinationKind(); - public abstract boolean isTemporaryDestination(); public static MessageWithDestination create( diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/testing/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaClientBaseTest.java b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/testing/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaClientBaseTest.java index bc37560748b8..e0ad5ff5df71 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/testing/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaClientBaseTest.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/testing/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaClientBaseTest.java @@ -158,7 +158,6 @@ protected static List sendAttributes( Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -189,7 +188,6 @@ protected static List receiveAttributes(boolean testHeaders) Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, @@ -218,7 +216,6 @@ protected static List processAttributes( Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/InterceptorsTest.java b/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/InterceptorsTest.java index 1fc0635baa35..90f658c53113 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/InterceptorsTest.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/InterceptorsTest.java @@ -85,7 +85,6 @@ void testInterceptors() throws InterruptedException { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer"))); @@ -97,7 +96,6 @@ void testInterceptors() throws InterruptedException { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/WrapperTest.java b/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/WrapperTest.java index 58d0e61043b3..0777f55afbd1 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/WrapperTest.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/WrapperTest.java @@ -113,7 +113,6 @@ protected static List sendAttributes(boolean testHeaders) { Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -138,7 +137,6 @@ private static List receiveAttributes(String greeting, boole Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, SHARED_TOPIC), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerAttributesGetter.java b/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerAttributesGetter.java index ab796dec0697..18e3fa44a1ea 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerAttributesGetter.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerAttributesGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.kafka.internal; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.stream.Collectors; @@ -21,11 +20,6 @@ public String getSystem(KafkaProcessRequest request) { return "kafka"; } - @Override - public String getDestinationKind(KafkaProcessRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Override public String getDestination(KafkaProcessRequest request) { return request.getRecord().topic(); diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaProducerAttributesGetter.java b/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaProducerAttributesGetter.java index 1c33870ddf70..2fb90ce43cbe 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaProducerAttributesGetter.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaProducerAttributesGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.kafka.internal; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.stream.Collectors; @@ -27,11 +26,6 @@ public String getSystem(KafkaProducerRequest request) { return "kafka"; } - @Override - public String getDestinationKind(KafkaProducerRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Override public String getDestination(KafkaProducerRequest request) { return request.getRecord().topic(); diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaReceiveAttributesGetter.java b/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaReceiveAttributesGetter.java index cbc858647981..2c4ba4b99871 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaReceiveAttributesGetter.java +++ b/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaReceiveAttributesGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.kafka.internal; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Set; @@ -23,11 +22,6 @@ public String getSystem(KafkaReceiveRequest request) { return "kafka"; } - @Override - public String getDestinationKind(KafkaReceiveRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Override @Nullable public String getDestination(KafkaReceiveRequest request) { diff --git a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy index b45cb51a1c44..c0f138fd6e75 100644 --- a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy +++ b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy @@ -42,13 +42,13 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { } KStream textLines = builder.stream(STREAM_PENDING) def values = textLines - .mapValues(new ValueMapper() { - @Override - String apply(String textLine) { - Span.current().setAttribute("asdf", "testing") - return textLine.toLowerCase() - } - }) + .mapValues(new ValueMapper() { + @Override + String apply(String textLine) { + Span.current().setAttribute("asdf", "testing") + return textLine.toLowerCase() + } + }) KafkaStreams streams try { @@ -57,7 +57,7 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { streams = new KafkaStreams(builder, config) } catch (MissingMethodException e) { def producer = Class.forName("org.apache.kafka.streams.kstream.Produced") - .with(Serdes.Integer(), Serdes.String()) + .with(Serdes.Integer(), Serdes.String()) values.to(STREAM_PROCESSED, producer) streams = new KafkaStreams(builder.build(), config) } @@ -84,9 +84,9 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { assertTraces(3) { traces.sort(orderByRootSpanName( - STREAM_PENDING + " send", - STREAM_PENDING + " receive", - STREAM_PROCESSED + " receive")) + STREAM_PENDING + " send", + STREAM_PENDING + " receive", + STREAM_PROCESSED + " receive")) SpanData producerPending, producerProcessed @@ -99,7 +99,6 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PENDING - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.startsWith("producer") } "$SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION" { it >= 0 } "$SemanticAttributes.MESSAGING_KAFKA_MESSAGE_OFFSET" 0 @@ -118,7 +117,6 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PENDING - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "receive" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.endsWith("consumer") } if (Boolean.getBoolean("testLatestDeps")) { @@ -136,7 +134,6 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PENDING - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.endsWith("consumer") } "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long @@ -159,7 +156,6 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PROCESSED - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.endsWith("producer") } "$SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION" { it >= 0 } "$SemanticAttributes.MESSAGING_KAFKA_MESSAGE_OFFSET" 0 @@ -177,7 +173,6 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PROCESSED - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "receive" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.startsWith("consumer") } if (Boolean.getBoolean("testLatestDeps")) { @@ -195,7 +190,6 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PROCESSED - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.startsWith("consumer") } "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long diff --git a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy index afa6471e95d7..060ebd9037bb 100644 --- a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy +++ b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy @@ -42,13 +42,13 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { } KStream textLines = builder.stream(STREAM_PENDING) def values = textLines - .mapValues(new ValueMapper() { - @Override - String apply(String textLine) { - Span.current().setAttribute("asdf", "testing") - return textLine.toLowerCase() - } - }) + .mapValues(new ValueMapper() { + @Override + String apply(String textLine) { + Span.current().setAttribute("asdf", "testing") + return textLine.toLowerCase() + } + }) KafkaStreams streams try { @@ -57,7 +57,7 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { streams = new KafkaStreams(builder, config) } catch (MissingMethodException e) { def producer = Class.forName("org.apache.kafka.streams.kstream.Produced") - .with(Serdes.Integer(), Serdes.String()) + .with(Serdes.Integer(), Serdes.String()) values.to(STREAM_PROCESSED, producer) streams = new KafkaStreams(builder.build(), config) } @@ -94,7 +94,6 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PENDING - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" "producer-1" "$SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION" { it >= 0 } "$SemanticAttributes.MESSAGING_KAFKA_MESSAGE_OFFSET" 0 @@ -109,7 +108,6 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PENDING - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.endsWith("consumer") } "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long @@ -135,7 +133,6 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PROCESSED - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" String "$SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION" { it >= 0 } "$SemanticAttributes.MESSAGING_KAFKA_MESSAGE_OFFSET" 0 @@ -149,7 +146,6 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "kafka" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" STREAM_PROCESSED - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID" { it.startsWith("consumer") } "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long diff --git a/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarBatchMessagingAttributesGetter.java b/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarBatchMessagingAttributesGetter.java index 03de52567623..addbd0647374 100644 --- a/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarBatchMessagingAttributesGetter.java +++ b/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarBatchMessagingAttributesGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.javaagent.instrumentation.pulsar.v2_8.telemetry; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -22,11 +21,6 @@ public String getSystem(PulsarBatchRequest request) { return "pulsar"; } - @Override - public String getDestinationKind(PulsarBatchRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Nullable @Override public String getDestination(PulsarBatchRequest request) { diff --git a/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarMessagingAttributesGetter.java b/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarMessagingAttributesGetter.java index cb6ed4bce187..92596589f49d 100644 --- a/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarMessagingAttributesGetter.java +++ b/instrumentation/pulsar/pulsar-2.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/telemetry/PulsarMessagingAttributesGetter.java @@ -9,7 +9,6 @@ import static java.util.Collections.singletonList; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.List; import javax.annotation.Nullable; import org.apache.pulsar.client.api.Message; @@ -22,11 +21,6 @@ public String getSystem(PulsarRequest request) { return "pulsar"; } - @Override - public String getDestinationKind(PulsarRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Nullable @Override public String getDestination(PulsarRequest request) { diff --git a/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy b/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy index 7dd80905372f..bcd170ad2c11 100644 --- a/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy +++ b/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy @@ -9,14 +9,7 @@ import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.apache.pulsar.client.admin.PulsarAdmin -import org.apache.pulsar.client.api.Consumer -import org.apache.pulsar.client.api.Message -import org.apache.pulsar.client.api.MessageListener -import org.apache.pulsar.client.api.Messages -import org.apache.pulsar.client.api.Producer -import org.apache.pulsar.client.api.PulsarClient -import org.apache.pulsar.client.api.Schema -import org.apache.pulsar.client.api.SubscriptionInitialPosition +import org.apache.pulsar.client.api.* import org.slf4j.Logger import org.slf4j.LoggerFactory import org.testcontainers.containers.PulsarContainer @@ -30,15 +23,13 @@ import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import java.util.regex.Pattern -import static io.opentelemetry.api.trace.SpanKind.CONSUMER -import static io.opentelemetry.api.trace.SpanKind.INTERNAL -import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.SpanKind.* class PulsarClientTest extends AgentInstrumentationSpecification { private static final Logger logger = LoggerFactory.getLogger(PulsarClientTest) private static final DockerImageName DEFAULT_IMAGE_NAME = - DockerImageName.parse("apachepulsar/pulsar:2.8.0") + DockerImageName.parse("apachepulsar/pulsar:2.8.0") @Shared private PulsarContainer pulsar @@ -61,9 +52,9 @@ class PulsarClientTest extends AgentInstrumentationSpecification { @Override def setupSpec() { pulsar = new PulsarContainer(DEFAULT_IMAGE_NAME) - .withEnv("PULSAR_MEM", "-Xmx128m") - .withLogConsumer(new Slf4jLogConsumer(logger)) - .withStartupTimeout(Duration.ofMinutes(2)) + .withEnv("PULSAR_MEM", "-Xmx128m") + .withLogConsumer(new Slf4jLogConsumer(logger)) + .withStartupTimeout(Duration.ofMinutes(2)) pulsar.start() brokerHost = pulsar.host @@ -87,8 +78,8 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testSendNonPartitionedTopic" admin.topics().createNonPartitionedTopic(topic) producer = - client.newProducer(Schema.STRING).topic(topic) - .enableBatching(false).create() + client.newProducer(Schema.STRING).topic(topic) + .enableBatching(false).create() when: String msg = "test" @@ -115,22 +106,22 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(1) admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -160,15 +151,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallReceive" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -198,15 +189,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallReceiveAsync" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: CompletableFuture> result = consumer.receiveAsync().whenComplete { receivedMsg, throwable -> @@ -248,15 +239,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallReceiveWithTimeout" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -286,15 +277,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallBatchReceive" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -335,15 +326,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallBatchReceiveAsync" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -396,22 +387,22 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(1) admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -441,8 +432,8 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testSendPartitionedTopic" admin.topics().createPartitionedTopic(topic, 2) producer = - client.newProducer(Schema.STRING).topic(topic) - .enableBatching(false).create() + client.newProducer(Schema.STRING).topic(topic) + .enableBatching(false).create() when: String msg = "test" @@ -470,22 +461,22 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(1) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .topic(topic) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .subscriptionName("test_sub") + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .topic(topic) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -504,7 +495,7 @@ class PulsarClientTest extends AgentInstrumentationSpecification { hasNoParent() } producerSpan(it, 1, span(0), topic, ~/${topic}-partition-.*send/, { it.startsWith(topic) }, msgId) - receiveSpan(it, 2, span(1), topic, ~/${topic}-partition-.*receive/, { it.startsWith(topic) }, msgId) + receiveSpan(it, 2, span(1), topic, ~/${topic}-partition-.*receive/, { it.startsWith(topic) }, msgId) processSpan(it, 3, span(2), topic, ~/${topic}-partition-.*process/, { it.startsWith(topic) }, msgId) } } @@ -519,13 +510,13 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(2) producer = client.newProducer(Schema.STRING) - .topic(topic1) - .enableBatching(false) - .create() + .topic(topic1) + .enableBatching(false) + .create() producer2 = client.newProducer(Schema.STRING) - .topic(topic2) - .enableBatching(false) - .create() + .topic(topic2) + .enableBatching(false) + .create() when: runWithSpan("parent1") { @@ -536,17 +527,17 @@ class PulsarClientTest extends AgentInstrumentationSpecification { } consumer = client.newConsumer(Schema.STRING) - .topic(topic2, topic1) - .subscriptionName("test_sub") - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .topic(topic2, topic1) + .subscriptionName("test_sub") + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() latch.await(1, TimeUnit.MINUTES) @@ -586,7 +577,6 @@ class PulsarClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.MESSAGING_SYSTEM" "pulsar" "$SemanticAttributes.NET_PEER_NAME" brokerHost "$SemanticAttributes.NET_PEER_PORT" brokerPort - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destination if (msgId == String) { "$SemanticAttributes.MESSAGING_MESSAGE_ID" String @@ -622,7 +612,6 @@ class PulsarClientTest extends AgentInstrumentationSpecification { } attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "pulsar" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.NET_PEER_NAME" brokerHost "$SemanticAttributes.NET_PEER_PORT" brokerPort "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destination @@ -655,7 +644,6 @@ class PulsarClientTest extends AgentInstrumentationSpecification { childOf parentSpan attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "pulsar" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destination if (msgId == String) { "$SemanticAttributes.MESSAGING_MESSAGE_ID" String diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelAttributesGetter.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelAttributesGetter.java index 3549511f5161..661838d71bec 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelAttributesGetter.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelAttributesGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.javaagent.instrumentation.rabbitmq; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; @@ -19,11 +18,6 @@ public String getSystem(ChannelAndMethod channelAndMethod) { return "rabbitmq"; } - @Override - public String getDestinationKind(ChannelAndMethod channelAndMethod) { - return SemanticAttributes.MessagingDestinationKindValues.QUEUE; - } - @Nullable @Override public String getDestination(ChannelAndMethod channelAndMethod) { diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitDeliveryAttributesGetter.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitDeliveryAttributesGetter.java index 870ab29913b9..41486c6691b6 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitDeliveryAttributesGetter.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitDeliveryAttributesGetter.java @@ -9,7 +9,6 @@ import static java.util.Collections.singletonList; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.List; import java.util.Map; import javax.annotation.Nullable; @@ -22,11 +21,6 @@ public String getSystem(DeliveryRequest request) { return "rabbitmq"; } - @Override - public String getDestinationKind(DeliveryRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.QUEUE; - } - @Nullable @Override public String getDestination(DeliveryRequest request) { diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveAttributesGetter.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveAttributesGetter.java index 315e0e4144b2..758b37365ce1 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveAttributesGetter.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveAttributesGetter.java @@ -7,7 +7,6 @@ import com.rabbitmq.client.GetResponse; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; @@ -21,11 +20,6 @@ public String getSystem(ReceiveRequest request) { return "rabbitmq"; } - @Override - public String getDestinationKind(ReceiveRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.QUEUE; - } - @Nullable @Override public String getDestination(ReceiveRequest request) { diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy index 970472c6da61..c3b3ec1149f4 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy @@ -3,14 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import com.rabbitmq.client.AMQP -import com.rabbitmq.client.Channel -import com.rabbitmq.client.Connection -import com.rabbitmq.client.Consumer -import com.rabbitmq.client.DefaultConsumer -import com.rabbitmq.client.Envelope -import com.rabbitmq.client.GetResponse -import com.rabbitmq.client.ShutdownSignalException + +import com.rabbitmq.client.* import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert @@ -26,9 +20,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit -import static io.opentelemetry.api.trace.SpanKind.CLIENT -import static io.opentelemetry.api.trace.SpanKind.CONSUMER -import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.SpanKind.* import static io.opentelemetry.api.trace.StatusCode.ERROR class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabbitMqTrait { @@ -143,8 +135,8 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb setup: channel.exchangeDeclare(exchangeName, "direct", false) String queueName = (messageCount % 2 == 0) ? - channel.queueDeclare().getQueue() : - channel.queueDeclare("some-queue", false, true, true, null).getQueue() + channel.queueDeclare().getQueue() : + channel.queueDeclare("some-queue", false, true, true, null).getQueue() channel.queueBind(queueName, exchangeName, "") def deliveries = [] @@ -161,8 +153,8 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb (1..messageCount).each { if (setTimestamp) { channel.basicPublish(exchangeName, "", - new AMQP.BasicProperties.Builder().timestamp(new Date()).build(), - "msg $it".getBytes()) + new AMQP.BasicProperties.Builder().timestamp(new Date()).build(), + "msg $it".getBytes()) } else { channel.basicPublish(exchangeName, "", null, "msg $it".getBytes()) } @@ -361,18 +353,18 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb } def rabbitSpan( - TraceAssert trace, - int index, - String exchange, - String routingKey, - String operation, - String resource, - SpanData parentSpan = null, - SpanData linkSpan = null, - Throwable exception = null, - String errorMsg = null, - boolean expectTimestamp = false, - boolean testHeaders = false + TraceAssert trace, + int index, + String exchange, + String routingKey, + String operation, + String resource, + SpanData parentSpan = null, + SpanData linkSpan = null, + Throwable exception = null, + String errorMsg = null, + boolean expectTimestamp = false, + boolean testHeaders = false ) { def spanName = resource @@ -426,7 +418,6 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" exchange - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY" { it == null || it == routingKey || it.startsWith("amq.gen-") } if (operation != null && operation != "send") { diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy index 875a28ef65e3..244b1ba6311b 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy @@ -27,7 +27,7 @@ class ReactorRabbitMqTest extends AgentInstrumentationSpecification implements W when: sender.declareExchange(ExchangeSpecification.exchange("testExchange")) - .block() + .block() then: noExceptionThrown() @@ -42,7 +42,6 @@ class ReactorRabbitMqTest extends AgentInstrumentationSpecification implements W "$SemanticAttributes.NET_SOCK_PEER_PORT" Long "$SemanticAttributes.NET_SOCK_FAMILY" { it == SemanticAttributes.NetSockFamilyValues.INET6 || it == null } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "rabbitmq.command" "exchange.declare" } } diff --git a/instrumentation/reactor/reactor-kafka-1.0/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/AbstractReactorKafkaTest.java b/instrumentation/reactor/reactor-kafka-1.0/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/AbstractReactorKafkaTest.java index 05b0f22dbff4..068a1f5858a8 100644 --- a/instrumentation/reactor/reactor-kafka-1.0/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/AbstractReactorKafkaTest.java +++ b/instrumentation/reactor/reactor-kafka-1.0/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/reactor/kafka/v1_0/AbstractReactorKafkaTest.java @@ -180,7 +180,6 @@ protected static List sendAttributes(ProducerRecord stringAssert.startsWith("producer")), @@ -203,7 +202,6 @@ protected static List receiveAttributes(String topic) { asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, topic), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, @@ -225,7 +223,6 @@ protected static List processAttributes( asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, record.topic()), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqConsumerAttributeGetter.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqConsumerAttributeGetter.java index 6f5ef1fa7ebc..b1a346998c31 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqConsumerAttributeGetter.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqConsumerAttributeGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.rocketmqclient.v4_8; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; @@ -20,11 +19,6 @@ public String getSystem(MessageExt request) { return "rocketmq"; } - @Override - public String getDestinationKind(MessageExt request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Override public String getDestination(MessageExt request) { return request.getTopic(); diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqProducerAttributeGetter.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqProducerAttributeGetter.java index d13c9e480b3f..0bd95d85d5c4 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqProducerAttributeGetter.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqProducerAttributeGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.rocketmqclient.v4_8; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; @@ -23,11 +22,6 @@ public String getSystem(SendMessageContext sendMessageContext) { return "rocketmq"; } - @Override - public String getDestinationKind(SendMessageContext sendMessageContext) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Nullable @Override public String getDestination(SendMessageContext sendMessageContext) { diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy index 2ca9a2ec8e1f..db8cd52558a1 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy @@ -21,9 +21,7 @@ import spock.lang.Unroll import java.util.concurrent.CompletableFuture import java.util.concurrent.TimeUnit -import static io.opentelemetry.api.trace.SpanKind.CONSUMER -import static io.opentelemetry.api.trace.SpanKind.INTERNAL -import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.SpanKind.* //TODO add tests for propagationEnabled flag @Unroll @@ -106,7 +104,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String @@ -120,7 +117,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String @@ -162,7 +158,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String @@ -176,7 +171,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String @@ -240,7 +234,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String "messaging.rocketmq.broker_address" String "messaging.rocketmq.send_result" "SEND_OK" @@ -263,7 +256,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String @@ -281,7 +273,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String @@ -327,7 +318,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String @@ -342,7 +332,6 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rocketmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" sharedTopic - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerProcessAttributeGetter.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerProcessAttributeGetter.java index b4285b46ccba..df7a7bf97aa9 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerProcessAttributeGetter.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerProcessAttributeGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.javaagent.instrumentation.rocketmqclient.v5_0; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; @@ -23,12 +22,6 @@ public String getSystem(MessageView messageView) { return "rocketmq"; } - @Nullable - @Override - public String getDestinationKind(MessageView messageView) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Nullable @Override public String getDestination(MessageView messageView) { diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerReceiveAttributeGetter.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerReceiveAttributeGetter.java index 2cc150609d95..87e4b4101faf 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerReceiveAttributeGetter.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqConsumerReceiveAttributeGetter.java @@ -7,7 +7,6 @@ import apache.rocketmq.v2.ReceiveMessageRequest; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.List; import javax.annotation.Nullable; import org.apache.rocketmq.client.apis.message.MessageView; @@ -22,12 +21,6 @@ public String getSystem(ReceiveMessageRequest request) { return "rocketmq"; } - @Nullable - @Override - public String getDestinationKind(ReceiveMessageRequest request) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Nullable @Override public String getDestination(ReceiveMessageRequest request) { diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqProducerAttributeGetter.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqProducerAttributeGetter.java index ba4a5fac65a9..0931a53c09b9 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqProducerAttributeGetter.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v5_0/RocketMqProducerAttributeGetter.java @@ -6,7 +6,6 @@ package io.opentelemetry.javaagent.instrumentation.rocketmqclient.v5_0; import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; @@ -23,12 +22,6 @@ public String getSystem(PublishingMessageImpl message) { return "rocketmq"; } - @Nullable - @Override - public String getDestinationKind(PublishingMessageImpl message) { - return SemanticAttributes.MessagingDestinationKindValues.TOPIC; - } - @Nullable @Override public String getDestination(PublishingMessageImpl message) { diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientSuppressReceiveSpanTest.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientSuppressReceiveSpanTest.java index e29780bb2992..6fe8e4fdea4c 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientSuppressReceiveSpanTest.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientSuppressReceiveSpanTest.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.rocketmqclient.v5_0; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; -import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_DESTINATION_KIND; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_DESTINATION_NAME; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_MESSAGE_ID; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES; @@ -22,7 +21,6 @@ import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier; import io.opentelemetry.sdk.trace.data.StatusData; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Arrays; @@ -123,9 +121,6 @@ void testSendAndConsumeMessage() throws Throwable { equalTo( MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic)), span -> span.hasKind(SpanKind.CONSUMER) @@ -143,9 +138,6 @@ void testSendAndConsumeMessage() throws Throwable { equalTo( MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic), equalTo(MESSAGING_OPERATION, "process")), span -> diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientTest.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientTest.java index 3c95fc409154..9d0dfcab91ff 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientTest.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientTest.java @@ -7,7 +7,6 @@ import static io.opentelemetry.instrumentation.testing.util.TelemetryDataUtil.orderByRootSpanKind; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; -import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_DESTINATION_KIND; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_DESTINATION_NAME; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_MESSAGE_ID; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES; @@ -32,7 +31,6 @@ import io.opentelemetry.sdk.trace.data.LinkData; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.data.StatusData; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.time.Duration; @@ -420,9 +418,6 @@ private static SpanDataAssert assertProducerSpan( equalTo(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, (long) body.length), equalTo(MESSAGING_SYSTEM, "rocketmq"), equalTo(MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic))); attributeAssertions.addAll(Arrays.asList(extraAttributes)); @@ -451,9 +446,6 @@ private static SpanDataAssert assertProducerSpanWithFifoMessage( equalTo(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, (long) body.length), equalTo(MESSAGING_SYSTEM, "rocketmq"), equalTo(MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic))); attributeAssertions.addAll(Arrays.asList(extraAttributes)); @@ -482,9 +474,6 @@ private static SpanDataAssert assertProducerSpanWithDelayMessage( equalTo(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, (long) body.length), equalTo(MESSAGING_SYSTEM, "rocketmq"), equalTo(MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic))); attributeAssertions.addAll(Arrays.asList(extraAttributes)); @@ -502,9 +491,6 @@ private static SpanDataAssert assertReceiveSpan( .hasAttributesSatisfyingExactly( equalTo(MESSAGING_ROCKETMQ_CLIENT_GROUP, consumerGroup), equalTo(MESSAGING_SYSTEM, "rocketmq"), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic), equalTo(MESSAGING_OPERATION, "receive")); } @@ -528,9 +514,6 @@ private static SpanDataAssert assertProcessSpan( equalTo(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, (long) body.length), equalTo(MESSAGING_SYSTEM, "rocketmq"), equalTo(MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic), equalTo(MESSAGING_OPERATION, "process"))); attributeAssertions.addAll(Arrays.asList(extraAttributes)); @@ -564,9 +547,6 @@ private static SpanDataAssert assertProcessSpanWithFifoMessage( equalTo(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, (long) body.length), equalTo(MESSAGING_SYSTEM, "rocketmq"), equalTo(MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic), equalTo(MESSAGING_OPERATION, "process"))); attributeAssertions.addAll(Arrays.asList(extraAttributes)); @@ -600,9 +580,6 @@ private static SpanDataAssert assertProcessSpanWithDelayMessage( equalTo(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, (long) body.length), equalTo(MESSAGING_SYSTEM, "rocketmq"), equalTo(MESSAGING_MESSAGE_ID, sendReceipt.getMessageId().toString()), - equalTo( - MESSAGING_DESTINATION_KIND, - SemanticAttributes.MessagingDestinationKindValues.TOPIC), equalTo(MESSAGING_DESTINATION_NAME, topic), equalTo(MESSAGING_OPERATION, "process"))); attributeAssertions.addAll(Arrays.asList(extraAttributes)); diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/kafka/KafkaIntegrationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/kafka/KafkaIntegrationTest.java index 3decd7a88f9a..a086bed7b397 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/kafka/KafkaIntegrationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/kafka/KafkaIntegrationTest.java @@ -109,7 +109,6 @@ private static void runShouldInstrumentProducerAndConsumer( .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -127,7 +126,6 @@ private static void runShouldInstrumentProducerAndConsumer( .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy b/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy index c3873074ec63..eb9581213840 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy +++ b/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy @@ -3,12 +3,11 @@ * SPDX-License-Identifier: Apache-2.0 */ + import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.semconv.trace.attributes.SemanticAttributes -import static io.opentelemetry.api.trace.SpanKind.CLIENT -import static io.opentelemetry.api.trace.SpanKind.CONSUMER -import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.SpanKind.* class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification implements WithRabbitProducerConsumerTrait { def setupSpec() { @@ -47,7 +46,6 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i "$SemanticAttributes.NET_SOCK_PEER_PORT" Long "$SemanticAttributes.NET_SOCK_FAMILY" { it == SemanticAttributes.NetSockFamilyValues.INET6 || it == null } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" } } span(3) { @@ -61,7 +59,6 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i "$SemanticAttributes.NET_SOCK_FAMILY" { it == SemanticAttributes.NetSockFamilyValues.INET6 || it == null } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "testTopic" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY" String } @@ -76,7 +73,6 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "testTopic" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY" String @@ -91,7 +87,6 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "testTopic" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long @@ -114,7 +109,6 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i "$SemanticAttributes.NET_SOCK_PEER_PORT" Long "$SemanticAttributes.NET_SOCK_FAMILY" { it == SemanticAttributes.NetSockFamilyValues.INET6 || it == null } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" } } } diff --git a/instrumentation/spring/spring-integration-4.1/library/src/main/java/io/opentelemetry/instrumentation/spring/integration/v4_1/SpringMessagingAttributesGetter.java b/instrumentation/spring/spring-integration-4.1/library/src/main/java/io/opentelemetry/instrumentation/spring/integration/v4_1/SpringMessagingAttributesGetter.java index d3223c126d93..1632b31f121e 100644 --- a/instrumentation/spring/spring-integration-4.1/library/src/main/java/io/opentelemetry/instrumentation/spring/integration/v4_1/SpringMessagingAttributesGetter.java +++ b/instrumentation/spring/spring-integration-4.1/library/src/main/java/io/opentelemetry/instrumentation/spring/integration/v4_1/SpringMessagingAttributesGetter.java @@ -21,12 +21,6 @@ public String getSystem(MessageWithChannel messageWithChannel) { return null; } - @Override - @Nullable - public String getDestinationKind(MessageWithChannel messageWithChannel) { - return null; - } - @Override @Nullable public String getDestination(MessageWithChannel messageWithChannel) { diff --git a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringListenerTest.groovy b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringListenerTest.groovy index eb19bac04b4f..e5db7900c1cc 100644 --- a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringListenerTest.groovy +++ b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringListenerTest.groovy @@ -31,11 +31,11 @@ class SpringListenerTest extends AgentInstrumentationSpecification { traces.sort(orderByRootSpanKind(CONSUMER, PRODUCER)) trace(0, 1) { - consumerSpan(it, 0, "queue", "SpringListenerJms2", "", null, "receive") + consumerSpan(it, 0, "SpringListenerJms2", "", null, "receive") } trace(1, 2) { - producerSpan(it, 0, "queue", "SpringListenerJms2") - consumerSpan(it, 1, "queue", "SpringListenerJms2", "", span(0), "process") + producerSpan(it, 0, "SpringListenerJms2") + consumerSpan(it, 1, "SpringListenerJms2", "", span(0), "process") } } @@ -46,7 +46,7 @@ class SpringListenerTest extends AgentInstrumentationSpecification { config << [AnnotatedListenerConfig, ManualListenerConfig] } - static producerSpan(TraceAssert trace, int index, String destinationType, String destinationName, boolean testHeaders = false) { + static producerSpan(TraceAssert trace, int index, String destinationName, boolean testHeaders = false) { trace.span(index) { name destinationName + " send" kind PRODUCER @@ -54,7 +54,6 @@ class SpringListenerTest extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "jms" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType if (destinationName == "(temporary)") { "$SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY" true } @@ -70,7 +69,7 @@ class SpringListenerTest extends AgentInstrumentationSpecification { // passing messageId = null will verify message.id is not captured, // passing messageId = "" will verify message.id is captured (but won't verify anything about the value), // any other value for messageId will verify that message.id is captured and has that same value - static consumerSpan(TraceAssert trace, int index, String destinationType, String destinationName, String messageId, Object parentOrLinkedSpan, String operation, boolean testHeaders = false) { + static consumerSpan(TraceAssert trace, int index, String destinationName, String messageId, Object parentOrLinkedSpan, String operation, boolean testHeaders = false) { trace.span(index) { name destinationName + " " + operation kind CONSUMER @@ -82,7 +81,6 @@ class SpringListenerTest extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "jms" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" destinationName - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" destinationType "$SemanticAttributes.MESSAGING_OPERATION" operation if (messageId != null) { //In some tests we don't know exact messageId, so we pass "" and verify just the existence of the attribute diff --git a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy index 0233c552eb25..dfaa4bf9945d 100644 --- a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy +++ b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy @@ -3,10 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ + import com.google.common.io.Files import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification -import javax.jms.JMSException -import javax.jms.Message import org.hornetq.api.core.TransportConfiguration import org.hornetq.api.core.client.HornetQClient import org.hornetq.api.jms.HornetQJMSClient @@ -22,9 +21,7 @@ import org.springframework.jms.core.JmsTemplate import org.springframework.jms.core.MessagePostProcessor import spock.lang.Shared -import javax.jms.Connection -import javax.jms.Session -import javax.jms.TextMessage +import javax.jms.* import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference @@ -69,7 +66,7 @@ class SpringTemplateTest extends AgentInstrumentationSpecification { serverLocator.close() def connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, - new TransportConfiguration(InVMConnectorFactory.name)) + new TransportConfiguration(InVMConnectorFactory.name)) connection = connectionFactory.createConnection() connection.start() @@ -95,16 +92,16 @@ class SpringTemplateTest extends AgentInstrumentationSpecification { receivedMessage.text == messageText assertTraces(2) { trace(0, 1) { - producerSpan(it, 0, destinationType, destinationName) + producerSpan(it, 0, destinationName) } trace(1, 1) { - consumerSpan(it, 0, destinationType, destinationName, receivedMessage.getJMSMessageID(), null, "receive") + consumerSpan(it, 0, destinationName, receivedMessage.getJMSMessageID(), null, "receive") } } where: - destination | destinationType | destinationName - session.createQueue("SpringTemplateJms2") | "queue" | "SpringTemplateJms2" + destination | destinationName + session.createQueue("SpringTemplateJms2") | "SpringTemplateJms2" } def "send and receive message generates spans"() { @@ -128,28 +125,28 @@ class SpringTemplateTest extends AgentInstrumentationSpecification { receivedMessage.text == "responded!" assertTraces(4) { traces.sort(orderByRootSpanName( - "$destinationName receive", - "$destinationName send", - "(temporary) receive", - "(temporary) send")) + "$destinationName receive", + "$destinationName send", + "(temporary) receive", + "(temporary) send")) trace(0, 1) { - consumerSpan(it, 0, destinationType, destinationName, msgId.get(), null, "receive") + consumerSpan(it, 0, destinationName, msgId.get(), null, "receive") } trace(1, 1) { - producerSpan(it, 0, destinationType, destinationName) + producerSpan(it, 0, destinationName) } trace(2, 1) { - consumerSpan(it, 0, "queue", "(temporary)", receivedMessage.getJMSMessageID(), null, "receive") + consumerSpan(it, 0, "(temporary)", receivedMessage.getJMSMessageID(), null, "receive") } trace(3, 1) { - producerSpan(it, 0, "queue", "(temporary)") + producerSpan(it, 0, "(temporary)") } } where: - destination | destinationType | destinationName - session.createQueue("SpringTemplateJms2") | "queue" | "SpringTemplateJms2" + destination | destinationName + session.createQueue("SpringTemplateJms2") | "SpringTemplateJms2" } def "capture message header as span attribute"() { @@ -168,15 +165,15 @@ class SpringTemplateTest extends AgentInstrumentationSpecification { receivedMessage.text == messageText assertTraces(2) { trace(0, 1) { - producerSpan(it, 0, destinationType, destinationName, true) + producerSpan(it, 0, destinationName, true) } trace(1, 1) { - consumerSpan(it, 0, destinationType, destinationName, receivedMessage.getJMSMessageID(), null, "receive", true) + consumerSpan(it, 0, destinationName, receivedMessage.getJMSMessageID(), null, "receive", true) } } where: - destination | destinationType | destinationName - session.createQueue("SpringTemplateJms2") | "queue" | "SpringTemplateJms2" + destination | destinationName + session.createQueue("SpringTemplateJms2") | "SpringTemplateJms2" } } diff --git a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/testReceiveSpansDisabled/groovy/SpringListenerSuppressReceiveSpansTest.groovy b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/testReceiveSpansDisabled/groovy/SpringListenerSuppressReceiveSpansTest.groovy index 8516b872633f..d628dd079cf4 100644 --- a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/testReceiveSpansDisabled/groovy/SpringListenerSuppressReceiveSpansTest.groovy +++ b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/testReceiveSpansDisabled/groovy/SpringListenerSuppressReceiveSpansTest.groovy @@ -22,8 +22,8 @@ class SpringListenerSuppressReceiveSpansTest extends AgentInstrumentationSpecifi expect: assertTraces(1) { trace(0, 2) { - SpringListenerTest.producerSpan(it, 0, "queue", "SpringListenerJms2") - SpringListenerTest.consumerSpan(it, 1, "queue", "SpringListenerJms2", "", span(0), "process") + SpringListenerTest.producerSpan(it, 0, "SpringListenerJms2") + SpringListenerTest.consumerSpan(it, 1, "SpringListenerJms2", "", span(0), "process") } } diff --git a/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/jms/v6_0/SpringJmsListenerTest.java b/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/jms/v6_0/SpringJmsListenerTest.java index 12f48ab13d32..cdb4d8c05128 100644 --- a/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/jms/v6_0/SpringJmsListenerTest.java +++ b/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/jms/v6_0/SpringJmsListenerTest.java @@ -115,7 +115,6 @@ void testSpringJmsListener(Class configClass) equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "spring-jms-listener"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "queue"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_ID, AbstractStringAssert::isNotBlank)), @@ -128,7 +127,6 @@ void testSpringJmsListener(Class configClass) equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "spring-jms-listener"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "queue"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_ID, @@ -145,7 +143,6 @@ void testSpringJmsListener(Class configClass) equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "spring-jms-listener"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "queue"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_ID, @@ -198,7 +195,6 @@ void shouldCaptureHeaders(Class configClass) equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "spring-jms-listener"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "queue"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_ID, AbstractStringAssert::isNotBlank), @@ -217,7 +213,6 @@ void shouldCaptureHeaders(Class configClass) equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "spring-jms-listener"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "queue"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_ID, @@ -240,7 +235,6 @@ void shouldCaptureHeaders(Class configClass) equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "spring-jms-listener"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "queue"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_ID, diff --git a/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaTest.java b/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaTest.java index 71c79e7c4b74..f07f5b172350 100644 --- a/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaTest.java +++ b/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/kafka/v2_7/SpringKafkaTest.java @@ -68,7 +68,6 @@ void shouldCreateSpansForSingleRecordProcess() { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION, AbstractLongAssert::isNotNegative), @@ -92,7 +91,6 @@ void shouldCreateSpansForSingleRecordProcess() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, @@ -113,7 +111,6 @@ void shouldCreateSpansForSingleRecordProcess() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, @@ -167,7 +164,6 @@ void shouldHandleFailureInKafkaListener() { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION, AbstractLongAssert::isNotNegative), @@ -191,7 +187,6 @@ void shouldHandleFailureInKafkaListener() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, @@ -214,7 +209,6 @@ void shouldHandleFailureInKafkaListener() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, @@ -264,7 +258,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION, AbstractLongAssert::isNotNegative), @@ -282,7 +275,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION, AbstractLongAssert::isNotNegative), @@ -307,7 +299,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, @@ -330,7 +321,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, @@ -371,7 +361,6 @@ void shouldHandleFailureInKafkaBatchListener() { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_DESTINATION_PARTITION, AbstractLongAssert::isNotNegative), @@ -395,7 +384,6 @@ void shouldHandleFailureInKafkaBatchListener() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "receive"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, @@ -418,7 +406,6 @@ void shouldHandleFailureInKafkaBatchListener() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, diff --git a/instrumentation/spring/spring-kafka-2.7/testing/src/main/java/io/opentelemetry/testing/AbstractSpringKafkaNoReceiveTelemetryTest.java b/instrumentation/spring/spring-kafka-2.7/testing/src/main/java/io/opentelemetry/testing/AbstractSpringKafkaNoReceiveTelemetryTest.java index b47638dbe021..07beb409d242 100644 --- a/instrumentation/spring/spring-kafka-2.7/testing/src/main/java/io/opentelemetry/testing/AbstractSpringKafkaNoReceiveTelemetryTest.java +++ b/instrumentation/spring/spring-kafka-2.7/testing/src/main/java/io/opentelemetry/testing/AbstractSpringKafkaNoReceiveTelemetryTest.java @@ -48,7 +48,6 @@ void shouldCreateSpansForSingleRecordProcess() { equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -68,7 +67,6 @@ void shouldCreateSpansForSingleRecordProcess() { equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, @@ -120,7 +118,6 @@ void shouldHandleFailureInKafkaListener() { equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -142,7 +139,6 @@ void shouldHandleFailureInKafkaListener() { equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testSingleTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, @@ -191,7 +187,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -210,7 +205,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -240,7 +234,6 @@ void shouldCreateSpansForBatchReceiveAndProcess() throws InterruptedException { equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, @@ -284,7 +277,6 @@ void shouldHandleFailureInKafkaBatchListener() { equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -312,7 +304,6 @@ void shouldHandleFailureInKafkaBatchListener() { equalTo( SemanticAttributes.MESSAGING_DESTINATION_NAME, "testBatchTopic"), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), equalTo( SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP, diff --git a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/rabbit/v1_0/SpringRabbitMessageAttributesGetter.java b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/rabbit/v1_0/SpringRabbitMessageAttributesGetter.java index ca19d71979b0..725e83858741 100644 --- a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/rabbit/v1_0/SpringRabbitMessageAttributesGetter.java +++ b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/rabbit/v1_0/SpringRabbitMessageAttributesGetter.java @@ -19,11 +19,6 @@ public String getSystem(Message message) { return "rabbitmq"; } - @Override - public String getDestinationKind(Message message) { - return "queue"; - } - @Override @Nullable public String getDestination(Message message) { diff --git a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy index 5724ea40cef1..b9d30e24ba53 100644 --- a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy +++ b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ + import com.rabbitmq.client.ConnectionFactory import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.testing.GlobalTraceUtil @@ -25,9 +26,7 @@ import spock.lang.Unroll import java.time.Duration -import static io.opentelemetry.api.trace.SpanKind.CLIENT -import static io.opentelemetry.api.trace.SpanKind.CONSUMER -import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.SpanKind.* class ContextPropagationTest extends AgentInstrumentationSpecification { @@ -40,23 +39,23 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { def setupSpec() { rabbitMqContainer = new GenericContainer('rabbitmq:latest') - .withExposedPorts(5672) - .waitingFor(Wait.forLogMessage(".*Server startup complete.*", 1)) - .withStartupTimeout(Duration.ofMinutes(2)) + .withExposedPorts(5672) + .waitingFor(Wait.forLogMessage(".*Server startup complete.*", 1)) + .withStartupTimeout(Duration.ofMinutes(2)) rabbitMqContainer.start() def app = new SpringApplication(ConsumerConfig) app.setDefaultProperties([ - "spring.jmx.enabled" : false, - "spring.main.web-application-type": "none", - "spring.rabbitmq.host" : rabbitMqContainer.host, - "spring.rabbitmq.port" : rabbitMqContainer.getMappedPort(5672), + "spring.jmx.enabled" : false, + "spring.main.web-application-type": "none", + "spring.rabbitmq.host" : rabbitMqContainer.host, + "spring.rabbitmq.port" : rabbitMqContainer.getMappedPort(5672), ]) applicationContext = app.run() connectionFactory = new ConnectionFactory( - host: rabbitMqContainer.host, - port: rabbitMqContainer.getMappedPort(5672) + host: rabbitMqContainer.host, + port: rabbitMqContainer.getMappedPort(5672) ) } @@ -75,16 +74,16 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { runWithSpan("parent") { if (testHeaders) { applicationContext.getBean(AmqpTemplate) - .convertAndSend(ConsumerConfig.TEST_QUEUE, (Object) "test", new MessagePostProcessor() { - @Override - Message postProcessMessage(Message message) throws AmqpException { - message.getMessageProperties().setHeader("test-message-header", "test") - return message - } - }) + .convertAndSend(ConsumerConfig.TEST_QUEUE, (Object) "test", new MessagePostProcessor() { + @Override + Message postProcessMessage(Message message) throws AmqpException { + message.getMessageProperties().setHeader("test-message-header", "test") + return message + } + }) } else { applicationContext.getBean(AmqpTemplate) - .convertAndSend(ConsumerConfig.TEST_QUEUE, "test") + .convertAndSend(ConsumerConfig.TEST_QUEUE, "test") } } @@ -113,7 +112,6 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_SOCK_PEER_PORT" Long "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY" String if (testHeaders) { @@ -131,7 +129,6 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY" String @@ -148,7 +145,6 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { attributes { "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "testQueue" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long if (testHeaders) { @@ -170,7 +166,6 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_SOCK_PEER_ADDR" { it == "127.0.0.1" || it == null } "$SemanticAttributes.NET_SOCK_PEER_PORT" Long "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" - "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" } } } diff --git a/instrumentation/vertx/vertx-kafka-client-3.6/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/AbstractVertxKafkaTest.java b/instrumentation/vertx/vertx-kafka-client-3.6/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/AbstractVertxKafkaTest.java index b5ca57e92f4a..67344abf49bb 100644 --- a/instrumentation/vertx/vertx-kafka-client-3.6/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/AbstractVertxKafkaTest.java +++ b/instrumentation/vertx/vertx-kafka-client-3.6/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/kafka/v3_6/AbstractVertxKafkaTest.java @@ -201,7 +201,6 @@ protected static List sendAttributes( Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, record.topic()), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, stringAssert -> stringAssert.startsWith("producer")), @@ -232,7 +231,6 @@ private static List batchConsumerAttributes(String topic, St Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, topic), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, operation), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, @@ -255,7 +253,6 @@ protected static List processAttributes( Arrays.asList( equalTo(SemanticAttributes.MESSAGING_SYSTEM, "kafka"), equalTo(SemanticAttributes.MESSAGING_DESTINATION_NAME, record.topic()), - equalTo(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic"), equalTo(SemanticAttributes.MESSAGING_OPERATION, "process"), satisfies( SemanticAttributes.MESSAGING_KAFKA_CLIENT_ID, From 56314cba4c1793d5ecb8aa6edf0e901b9466f879 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 9 Jun 2023 15:54:38 -0700 Subject: [PATCH 04/17] Update license report --- licenses/licenses.md | 98 ++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/licenses/licenses.md b/licenses/licenses.md index 8cb6048ba969..686aa8ecb44a 100644 --- a/licenses/licenses.md +++ b/licenses/licenses.md @@ -1,7 +1,7 @@ # javaagent ## Dependency License Report -_2023-06-03 19:26:17 EEST_ +_2023-06-09 15:53:28 PDT_ ## Apache License, Version 2.0 **1** **Group:** `com.blogspot.mydailyjava` **Name:** `weak-lock-free` **Version:** `0.18` @@ -37,212 +37,204 @@ _2023-06-03 19:26:17 EEST_ > - **POM Project URL**: [https://github.com/square/okio/](https://github.com/square/okio/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**7** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api` **Version:** `1.26.0` +**7** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**8** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api-events` **Version:** `1.26.0-alpha` +**8** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api-events` **Version:** `1.27.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**9** **Group:** `io.opentelemetry` **Name:** `opentelemetry-api-logs` **Version:** `1.26.0-alpha` +**9** **Group:** `io.opentelemetry` **Name:** `opentelemetry-context` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**10** **Group:** `io.opentelemetry` **Name:** `opentelemetry-context` **Version:** `1.26.0` -> - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) -> - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) - -**11** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-common` **Version:** `1.26.0` -> - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) -> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) - -**12** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-jaeger` **Version:** `1.26.0` +**10** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-common` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**13** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging` **Version:** `1.26.0` +**11** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-jaeger` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**14** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging-otlp` **Version:** `1.26.0` +**12** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**15** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp` **Version:** `1.26.0` +**13** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-logging-otlp` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**16** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp-common` **Version:** `1.26.0` +**14** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**17** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp-logs` **Version:** `1.26.0-alpha` +**15** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-otlp-common` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**18** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-prometheus` **Version:** `1.26.0-alpha` +**16** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-prometheus` **Version:** `1.27.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**19** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-zipkin` **Version:** `1.26.0` +**17** **Group:** `io.opentelemetry` **Name:** `opentelemetry-exporter-zipkin` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**20** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-incubator` **Version:** `1.26.0-alpha` +**18** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-incubator` **Version:** `1.27.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**21** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-kotlin` **Version:** `1.26.0` +**19** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-kotlin` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**22** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-trace-propagators` **Version:** `1.26.0` +**20** **Group:** `io.opentelemetry` **Name:** `opentelemetry-extension-trace-propagators` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**23** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk` **Version:** `1.26.0` +**21** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**24** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-common` **Version:** `1.26.0` +**22** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-common` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**25** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure` **Version:** `1.26.0-alpha` +**23** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure` **Version:** `1.27.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**26** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure-spi` **Version:** `1.26.0` +**24** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-autoconfigure-spi` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**27** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-incubator` **Version:** `1.26.0-alpha` +**25** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-incubator` **Version:** `1.27.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**28** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-jaeger-remote-sampler` **Version:** `1.26.0` +**26** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-extension-jaeger-remote-sampler` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**29** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-logs` **Version:** `1.26.0-alpha` +**27** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-logs` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**30** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-metrics` **Version:** `1.26.0` +**28** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-metrics` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**31** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-trace` **Version:** `1.26.0` +**29** **Group:** `io.opentelemetry` **Name:** `opentelemetry-sdk-trace` **Version:** `1.27.0` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**32** **Group:** `io.opentelemetry` **Name:** `opentelemetry-semconv` **Version:** `1.26.0-alpha` +**30** **Group:** `io.opentelemetry` **Name:** `opentelemetry-semconv` **Version:** `1.27.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) -**33** **Group:** `io.opentelemetry.contrib` **Name:** `opentelemetry-aws-xray-propagator` **Version:** `1.26.0-alpha` +**31** **Group:** `io.opentelemetry.contrib` **Name:** `opentelemetry-aws-xray-propagator` **Version:** `1.26.0-alpha` > - **POM Project URL**: [https://github.com/open-telemetry/opentelemetry-java-contrib](https://github.com/open-telemetry/opentelemetry-java-contrib) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**34** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-reporter` **Version:** `2.16.3` +**32** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-reporter` **Version:** `2.16.3` > - **Manifest Project URL**: [https://zipkin.io/](https://zipkin.io/) > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [zipkin-reporter-2.16.3.jar/META-INF/LICENSE](zipkin-reporter-2.16.3.jar/META-INF/LICENSE) -**35** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-sender-okhttp3` **Version:** `2.16.3` +**33** **Group:** `io.zipkin.reporter2` **Name:** `zipkin-sender-okhttp3` **Version:** `2.16.3` > - **Manifest Project URL**: [https://zipkin.io/](https://zipkin.io/) > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [zipkin-sender-okhttp3-2.16.3.jar/META-INF/LICENSE](zipkin-sender-okhttp3-2.16.3.jar/META-INF/LICENSE) -**36** **Group:** `io.zipkin.zipkin2` **Name:** `zipkin` **Version:** `2.23.2` +**34** **Group:** `io.zipkin.zipkin2` **Name:** `zipkin` **Version:** `2.23.2` > - **Manifest Project URL**: [http://zipkin.io/](http://zipkin.io/) > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [zipkin-2.23.2.jar/META-INF/LICENSE](zipkin-2.23.2.jar/META-INF/LICENSE) -**37** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.14.5` +**35** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.14.5` > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) > - **Embedded license files**: [byte-buddy-dep-1.14.5.jar/META-INF/LICENSE](byte-buddy-dep-1.14.5.jar/META-INF/LICENSE) - [byte-buddy-dep-1.14.5.jar/META-INF/NOTICE](byte-buddy-dep-1.14.5.jar/META-INF/NOTICE) -**38** **Group:** `org.jetbrains` **Name:** `annotations` **Version:** `13.0` +**36** **Group:** `org.jetbrains` **Name:** `annotations` **Version:** `13.0` > - **POM Project URL**: [http://www.jetbrains.org](http://www.jetbrains.org) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**39** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib` **Version:** `1.8.21` +**37** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib` **Version:** `1.8.22` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**40** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-common` **Version:** `1.8.21` +**38** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-common` **Version:** `1.8.22` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**41** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk7` **Version:** `1.8.21` +**39** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk7` **Version:** `1.8.22` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**42** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk8` **Version:** `1.8.21` +**40** **Group:** `org.jetbrains.kotlin` **Name:** `kotlin-stdlib-jdk8` **Version:** `1.8.22` > - **POM Project URL**: [https://kotlinlang.org/](https://kotlinlang.org/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -**43** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.5` +**41** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.5` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**44** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.5` +**42** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.5` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**45** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.5` +**43** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.5` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**46** **Group:** `org.snakeyaml` **Name:** `snakeyaml-engine` **Version:** `2.6` +**44** **Group:** `org.snakeyaml` **Name:** `snakeyaml-engine` **Version:** `2.6` > - **Manifest License**: Apache License, Version 2.0 (Not Packaged) > - **POM Project URL**: [https://bitbucket.org/snakeyaml/snakeyaml-engine](https://bitbucket.org/snakeyaml/snakeyaml-engine) > - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) ## MIT License -**47** **Group:** `org.slf4j` **Name:** `slf4j-api` **Version:** `2.0.7` +**45** **Group:** `org.slf4j` **Name:** `slf4j-api` **Version:** `2.0.7` > - **Project URL**: [http://www.slf4j.org](http://www.slf4j.org) > - **POM License**: MIT License - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) > - **Embedded license files**: [slf4j-api-2.0.7.jar/META-INF/LICENSE.txt](slf4j-api-2.0.7.jar/META-INF/LICENSE.txt) -**48** **Group:** `org.slf4j` **Name:** `slf4j-simple` **Version:** `2.0.7` +**46** **Group:** `org.slf4j` **Name:** `slf4j-simple` **Version:** `2.0.7` > - **Project URL**: [http://www.slf4j.org](http://www.slf4j.org) > - **POM License**: MIT License - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) > - **Embedded license files**: [slf4j-simple-2.0.7.jar/META-INF/LICENSE.txt](slf4j-simple-2.0.7.jar/META-INF/LICENSE.txt) ## The 3-Clause BSD License -**49** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.5` +**47** **Group:** `org.ow2.asm` **Name:** `asm` **Version:** `9.5` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**50** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.5` +**48** **Group:** `org.ow2.asm` **Name:** `asm-commons` **Version:** `9.5` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) > - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) > - **POM License**: The 3-Clause BSD License - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -**51** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.5` +**49** **Group:** `org.ow2.asm` **Name:** `asm-tree` **Version:** `9.5` > - **Manifest Project URL**: [http://asm.ow2.org](http://asm.ow2.org) > - **Manifest License**: The 3-Clause BSD License (Not Packaged) > - **POM Project URL**: [http://asm.ow2.io/](http://asm.ow2.io/) @@ -251,4 +243,4 @@ _2023-06-03 19:26:17 EEST_ ## Unknown -**52** **Group:** `com.squareup.okio` **Name:** `okio` **Version:** `3.2.0` +**50** **Group:** `com.squareup.okio` **Name:** `okio` **Version:** `3.2.0` From e312233f3b4312f54c8e3508bfd47244e3035e8b Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 9 Jun 2023 20:38:58 -0700 Subject: [PATCH 05/17] More --- ...strumentation.javaagent-testing.gradle.kts | 2 +- .../jul/JavaUtilLoggingHelper.java | 10 +- .../appender/v1_1/LoggingEventMapper.java | 8 +- .../src/jms2Test/groovy/Jms2Test.groovy | 2 +- .../javaagent/src/test/groovy/Jms1Test.groovy | 11 +- .../jms/v3_0/Jms3InstrumentationTest.java | 9 +- .../groovy/KafkaStreamsDefaultTest.groovy | 22 +- ...afkaStreamsSuppressReceiveSpansTest.groovy | 16 +- .../log4j/appender/v1_2/LogEventMapper.java | 8 +- .../log4j/appender/v2_17/Log4jHelper.java | 8 +- .../log4j-appender-2.17/library/README.md | 15 +- .../appender/v2_17/OpenTelemetryAppender.java | 8 +- .../OpenTelemetryAppenderConfigTest.java | 9 +- .../appender/v1_0/LogbackInstrumentation.java | 4 +- .../logback-appender-1.0/library/README.md | 15 +- .../appender/v1_0/OpenTelemetryAppender.java | 4 +- .../logback/appender/v1_0/Slf4j2Test.java | 7 +- .../v1_0/OpenTelemetryAppenderConfigTest.java | 7 +- .../ApplicationOpenTelemetry.java | 39 +++- .../v1_10/ApplicationOpenTelemetry110.java | 4 +- .../javaagent/build.gradle.kts | 11 + .../v1_27/ApplicationOpenTelemetry127.java | 32 +++ ...penTelemetryApiInstrumentationModule.java} | 13 +- .../v1_27/OpenTelemetryInstrumentation.java | 39 ++++ .../logs}/ApplicationLogRecordBuilder.java | 2 +- .../v1_27/logs}/ApplicationLogger.java | 2 +- .../v1_27/logs}/ApplicationLoggerBuilder.java | 2 +- .../logs}/ApplicationLoggerProvider.java | 8 +- .../v1_27/logs}/LogBridging.java | 2 +- .../opentelemetryapi/v1_27}/LoggerTest.java | 7 +- .../javaagent/build.gradle.kts | 27 --- .../OpenTelemetryLogsInstrumentation.java | 51 ---- .../pulsar/v2_8/PulsarClientTest.groovy | 219 +++++++++--------- .../src/test/groovy/RabbitMqTest.groovy | 46 ++-- .../test/groovy/ReactorRabbitMqTest.groovy | 2 +- .../v4_8/AbstractRocketMqClientTest.groovy | 4 +- .../OpenTelemetryAutoConfiguration.java | 9 +- .../OpenTelemetryAutoConfigurationTest.java | 7 - .../TraceAspectAutoConfigurationTest.java | 7 - ...egerSpanExporterAutoConfigurationTest.java | 7 - ...ngMetricExporterAutoConfigurationTest.java | 7 - ...gingSpanExporterAutoConfigurationTest.java | 7 - .../OtlpLogExporterAutoConfigurationTest.java | 7 - ...lpMetricExporterAutoConfigurationTest.java | 7 - ...OtlpSpanExporterAutoConfigurationTest.java | 7 - ...pkinSpanExporterAutoConfigurationTest.java | 7 - .../RestTemplateAutoConfigurationTest.java | 7 - .../WebClientAutoConfigurationTest.java | 7 - .../MicrometerShimAutoConfigurationTest.java | 7 - .../PropagationAutoConfigurationTest.java | 7 - .../PropagationPropertiesTest.java | 7 - .../OtelResourceAutoConfigurationTest.java | 7 - .../resources/OtelResourcePropertiesTest.java | 7 - .../SpringResourceConfigPropertiesTest.java | 7 - ...MvcFilterAutoConfigurationSpring6Test.java | 2 - .../WebMvcFilterAutoConfigurationTest.java | 2 - .../SpringIntegrationAndRabbitTest.groovy | 5 +- .../src/test/groovy/SpringTemplateTest.groovy | 17 +- .../test/groovy/ContextPropagationTest.groovy | 39 ++-- javaagent-tooling/build.gradle.kts | 1 + .../tooling/OpenTelemetryInstallerTest.groovy | 3 - .../ConfigurationPropertiesSupplierTest.java | 2 - javaagent/build.gradle.kts | 2 +- .../build.gradle.kts | 20 ++ settings.gradle.kts | 2 +- 65 files changed, 420 insertions(+), 478 deletions(-) create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryApiLogsInstrumentationModule.java => opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryApiInstrumentationModule.java} (61%) create mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryInstrumentation.java rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge => opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs}/ApplicationLogRecordBuilder.java (99%) rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge => opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs}/ApplicationLogger.java (97%) rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge => opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs}/ApplicationLoggerBuilder.java (98%) rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge => opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs}/ApplicationLoggerProvider.java (75%) rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge => opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs}/LogBridging.java (98%) rename instrumentation/opentelemetry-api/{opentelemetry-api-logs-1.23/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs => opentelemetry-api-1.27/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27}/LoggerTest.java (96%) delete mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts delete mode 100644 instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryLogsInstrumentation.java diff --git a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts index e58dceb7c9db..d06428c99f16 100644 --- a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts +++ b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts @@ -79,7 +79,7 @@ class JavaagentTestArgumentsProvider( "-Dotel.javaagent.testing.javaagent-jar-path=${agentShadowJar.absolutePath}", "-Dotel.javaagent.experimental.initializer.jar=${shadowJar.absolutePath}", "-Dotel.javaagent.testing.additional-library-ignores.enabled=false", - "-Dotel.javaagent.testing.fail-on-context-leak=${findProperty("failOnContextLeak")!=false}", + "-Dotel.javaagent.testing.fail-on-context-leak=${findProperty("failOnContextLeak") != false}", // prevent sporadic gradle deadlocks, see SafeLogger for more details "-Dotel.javaagent.testing.transform-safe-logging.enabled=true", // Reduce noise in assertion messages since we don't need to verify this in most tests. We check diff --git a/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java b/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java index db9536afed34..bc9867c2160e 100644 --- a/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java +++ b/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java @@ -6,9 +6,9 @@ package io.opentelemetry.javaagent.instrumentation.jul; import application.java.util.logging.Logger; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.LogRecordBuilder; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.context.Context; @@ -41,7 +41,11 @@ public static void capture(Logger logger, LogRecord logRecord) { instrumentationName = "ROOT"; } LogRecordBuilder builder = - GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder(); + GlobalOpenTelemetry.get() + .getLogsBridge() + .loggerBuilder(instrumentationName) + .build() + .logRecordBuilder(); mapLogRecord(builder, logRecord); builder.emit(); } @@ -80,6 +84,8 @@ private static void mapLogRecord(LogRecordBuilder builder, LogRecord logRecord) // throwable Throwable throwable = logRecord.getThrown(); if (throwable != null) { + // TODO (trask) extract method for recording exception into + // io.opentelemetry:opentelemetry-api attributes.put(SemanticAttributes.EXCEPTION_TYPE, throwable.getClass().getName()); attributes.put(SemanticAttributes.EXCEPTION_MESSAGE, throwable.getMessage()); StringWriter writer = new StringWriter(); diff --git a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java index 72d513eee319..5bbe19c51ce9 100644 --- a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java +++ b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/LoggingEventMapper.java @@ -7,10 +7,10 @@ import static java.util.Collections.emptyList; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.LogRecordBuilder; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.context.Context; @@ -58,7 +58,11 @@ public void capture(Logger logger, ExtLogRecord record) { } LogRecordBuilder builder = - GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder(); + GlobalOpenTelemetry.get() + .getLogsBridge() + .loggerBuilder(instrumentationName) + .build() + .logRecordBuilder(); String message = record.getFormattedMessage(); if (message != null) { diff --git a/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy b/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy index 222e5b91b814..770586e3cf87 100644 --- a/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy +++ b/instrumentation/jms/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy @@ -69,7 +69,7 @@ class Jms2Test extends AgentInstrumentationSpecification { serverLocator.close() def connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, - new TransportConfiguration(InVMConnectorFactory.name)) + new TransportConfiguration(InVMConnectorFactory.name)) def connection = connectionFactory.createConnection() connection.start() diff --git a/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy b/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy index fe16b127a94a..330dc33851df 100644 --- a/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy +++ b/instrumentation/jms/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ - import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.sdk.trace.data.SpanData @@ -17,7 +16,11 @@ import org.testcontainers.containers.output.Slf4jLogConsumer import spock.lang.Shared import spock.lang.Unroll -import javax.jms.* +import javax.jms.Connection +import javax.jms.Message +import javax.jms.MessageListener +import javax.jms.Session +import javax.jms.TextMessage import java.util.concurrent.CountDownLatch import java.util.concurrent.atomic.AtomicReference @@ -30,8 +33,8 @@ class Jms1Test extends AgentInstrumentationSpecification { private static final Logger logger = LoggerFactory.getLogger(Jms1Test) private static final GenericContainer broker = new GenericContainer("rmohr/activemq:latest") - .withExposedPorts(61616, 8161) - .withLogConsumer(new Slf4jLogConsumer(logger)) + .withExposedPorts(61616, 8161) + .withLogConsumer(new Slf4jLogConsumer(logger)) @Shared String messageText = "a message" diff --git a/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java b/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java index 190b69ddf597..463524cd2223 100644 --- a/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java +++ b/instrumentation/jms/jms-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/v3_0/Jms3InstrumentationTest.java @@ -107,8 +107,7 @@ static void tearDown() throws JMSException { @ArgumentsSource(DestinationsProvider.class) @ParameterizedTest - void testMessageConsumer( - DestinationFactory destinationFactory, boolean isTemporary) + void testMessageConsumer(DestinationFactory destinationFactory, boolean isTemporary) throws JMSException { // given @@ -172,8 +171,7 @@ void testMessageConsumer( @ArgumentsSource(DestinationsProvider.class) @ParameterizedTest - void testMessageListener( - DestinationFactory destinationFactory, boolean isTemporary) + void testMessageListener(DestinationFactory destinationFactory, boolean isTemporary) throws Exception { // given @@ -254,8 +252,7 @@ void shouldNotEmitTelemetryOnEmptyReceive( @ArgumentsSource(DestinationsProvider.class) @ParameterizedTest - void shouldCaptureMessageHeaders( - DestinationFactory destinationFactory, boolean isTemporary) + void shouldCaptureMessageHeaders(DestinationFactory destinationFactory, boolean isTemporary) throws Exception { // given diff --git a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy index c0f138fd6e75..385a078b8e52 100644 --- a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy +++ b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsDefaultTest.groovy @@ -42,13 +42,13 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { } KStream textLines = builder.stream(STREAM_PENDING) def values = textLines - .mapValues(new ValueMapper() { - @Override - String apply(String textLine) { - Span.current().setAttribute("asdf", "testing") - return textLine.toLowerCase() - } - }) + .mapValues(new ValueMapper() { + @Override + String apply(String textLine) { + Span.current().setAttribute("asdf", "testing") + return textLine.toLowerCase() + } + }) KafkaStreams streams try { @@ -57,7 +57,7 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { streams = new KafkaStreams(builder, config) } catch (MissingMethodException e) { def producer = Class.forName("org.apache.kafka.streams.kstream.Produced") - .with(Serdes.Integer(), Serdes.String()) + .with(Serdes.Integer(), Serdes.String()) values.to(STREAM_PROCESSED, producer) streams = new KafkaStreams(builder.build(), config) } @@ -84,9 +84,9 @@ class KafkaStreamsDefaultTest extends KafkaStreamsBaseTest { assertTraces(3) { traces.sort(orderByRootSpanName( - STREAM_PENDING + " send", - STREAM_PENDING + " receive", - STREAM_PROCESSED + " receive")) + STREAM_PENDING + " send", + STREAM_PENDING + " receive", + STREAM_PROCESSED + " receive")) SpanData producerPending, producerProcessed diff --git a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy index 060ebd9037bb..d686ef0f8c57 100644 --- a/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy +++ b/instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsSuppressReceiveSpansTest.groovy @@ -42,13 +42,13 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { } KStream textLines = builder.stream(STREAM_PENDING) def values = textLines - .mapValues(new ValueMapper() { - @Override - String apply(String textLine) { - Span.current().setAttribute("asdf", "testing") - return textLine.toLowerCase() - } - }) + .mapValues(new ValueMapper() { + @Override + String apply(String textLine) { + Span.current().setAttribute("asdf", "testing") + return textLine.toLowerCase() + } + }) KafkaStreams streams try { @@ -57,7 +57,7 @@ class KafkaStreamsSuppressReceiveSpansTest extends KafkaStreamsBaseTest { streams = new KafkaStreams(builder, config) } catch (MissingMethodException e) { def producer = Class.forName("org.apache.kafka.streams.kstream.Produced") - .with(Serdes.Integer(), Serdes.String()) + .with(Serdes.Integer(), Serdes.String()) values.to(STREAM_PROCESSED, producer) streams = new KafkaStreams(builder.build(), config) } diff --git a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java index 12209df13ae5..21d57b044e5f 100644 --- a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java +++ b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v1_2/LogEventMapper.java @@ -7,10 +7,10 @@ import static java.util.Collections.emptyList; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.LogRecordBuilder; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.context.Context; @@ -64,7 +64,11 @@ public void capture(Category logger, Priority level, Object message, Throwable t instrumentationName = "ROOT"; } LogRecordBuilder builder = - GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder(); + GlobalOpenTelemetry.get() + .getLogsBridge() + .loggerBuilder(instrumentationName) + .build() + .logRecordBuilder(); // message if (message != null) { diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java index d15cddca5fa8..5d0cf18b17e1 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/log4j/appender/v2_17/Log4jHelper.java @@ -7,7 +7,7 @@ import static java.util.Collections.emptyList; -import io.opentelemetry.api.logs.GlobalLoggerProvider; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LogRecordBuilder; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.ContextDataAccessor; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.LogEventMapper; @@ -59,7 +59,11 @@ public static void capture( instrumentationName = "ROOT"; } LogRecordBuilder builder = - GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder(); + GlobalOpenTelemetry.get() + .getLogsBridge() + .loggerBuilder(instrumentationName) + .build() + .logRecordBuilder(); Map contextData = ThreadContext.getImmutableContext(); mapper.mapLogEvent(builder, message, level, marker, throwable, contextData); builder.emit(); diff --git a/instrumentation/log4j/log4j-appender-2.17/library/README.md b/instrumentation/log4j/log4j-appender-2.17/library/README.md index de35db0e03d6..4944d252da91 100644 --- a/instrumentation/log4j/log4j-appender-2.17/library/README.md +++ b/instrumentation/log4j/log4j-appender-2.17/library/README.md @@ -14,6 +14,7 @@ release](https://search.maven.org/search?q=g:io.opentelemetry.instrumentation%20 For Maven, add to your `pom.xml` dependencies: ```xml + io.opentelemetry.instrumentation @@ -53,17 +54,5 @@ The following demonstrates how you might configure the appender in your `log4j.x ``` -Next, configure `GlobalLoggerProvider` with an `SdkLoggerProvider` in your application. - -``` -SdkLoggerProvider sdkLoggerProvider = - SdkLoggerProvider.builder() - .setResource(Resource.create(...)) - .addLogProcessor(...) - .build(); -GlobalLoggerProvider.set(sdkLoggerProvider); -``` - In this example Log4j2 log events will be sent to both the console appender and -the `OpenTelemetryAppender`, which will drop the logs until `GlobalLoggerProvider.set(..)` is -called. Once initialized, logs will be emitted to a `Logger` obtained from the `SdkLoggerProvider`. +the `OpenTelemetryAppender`. diff --git a/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppender.java b/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppender.java index b1cc3047b74a..da324cb6aa52 100644 --- a/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppender.java +++ b/instrumentation/log4j/log4j-appender-2.17/library/src/main/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppender.java @@ -8,7 +8,7 @@ import static java.util.Collections.emptyList; import com.google.errorprone.annotations.CanIgnoreReturnValue; -import io.opentelemetry.api.logs.GlobalLoggerProvider; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LogRecordBuilder; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.ContextDataAccessor; import io.opentelemetry.instrumentation.log4j.appender.v2_17.internal.LogEventMapper; @@ -146,7 +146,11 @@ public void append(LogEvent event) { instrumentationName = "ROOT"; } LogRecordBuilder builder = - GlobalLoggerProvider.get().loggerBuilder(instrumentationName).build().logRecordBuilder(); + GlobalOpenTelemetry.get() + .getLogsBridge() + .loggerBuilder(instrumentationName) + .build() + .logRecordBuilder(); ReadOnlyStringMap contextData = event.getContextData(); mapper.mapLogEvent( builder, diff --git a/instrumentation/log4j/log4j-appender-2.17/library/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppenderConfigTest.java b/instrumentation/log4j/log4j-appender-2.17/library/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppenderConfigTest.java index 2176439232f6..243fa02efec9 100644 --- a/instrumentation/log4j/log4j-appender-2.17/library/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppenderConfigTest.java +++ b/instrumentation/log4j/log4j-appender-2.17/library/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/OpenTelemetryAppenderConfigTest.java @@ -6,16 +6,17 @@ package io.opentelemetry.instrumentation.log4j.appender.v2_17; import static io.opentelemetry.api.common.AttributeKey.stringKey; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.context.Scope; +import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.data.LogRecordData; @@ -60,8 +61,8 @@ static void setupAll() { .addLogRecordProcessor(SimpleLogRecordProcessor.create(logRecordExporter)) .build(); - GlobalLoggerProvider.resetForTest(); - GlobalLoggerProvider.set(loggerProvider); + GlobalOpenTelemetry.resetForTest(); + GlobalOpenTelemetry.set(OpenTelemetrySdk.builder().setLoggerProvider(loggerProvider).build()); } @BeforeEach diff --git a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackInstrumentation.java b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackInstrumentation.java index 57bf5df94b9f..cbd366729750 100644 --- a/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackInstrumentation.java +++ b/instrumentation/logback/logback-appender-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/logback/appender/v1_0/LogbackInstrumentation.java @@ -13,7 +13,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments; import ch.qos.logback.classic.spi.ILoggingEvent; -import io.opentelemetry.api.logs.GlobalLoggerProvider; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.logs.LoggerProvider; import io.opentelemetry.javaagent.bootstrap.CallDepth; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; @@ -51,7 +51,7 @@ public static void methodEnter( // logging framework delegates to another callDepth = CallDepth.forClass(LoggerProvider.class); if (callDepth.getAndIncrement() == 0) { - mapper().emit(GlobalLoggerProvider.get(), event); + mapper().emit(GlobalOpenTelemetry.get().getLogsBridge(), event); } } diff --git a/instrumentation/logback/logback-appender-1.0/library/README.md b/instrumentation/logback/logback-appender-1.0/library/README.md index 6107ff0aea7e..171d02b63efb 100644 --- a/instrumentation/logback/logback-appender-1.0/library/README.md +++ b/instrumentation/logback/logback-appender-1.0/library/README.md @@ -14,6 +14,7 @@ release](https://search.maven.org/search?q=g:io.opentelemetry.instrumentation%20 For Maven, add to your `pom.xml` dependencies: ```xml + io.opentelemetry.instrumentation @@ -57,17 +58,5 @@ The following demonstrates how you might configure the appender in your `logback ``` -Next, configure `GlobalLoggerProvider` with an `SdkLoggerProvider` in your application. - -``` -SdkLoggerProvider sdkLoggerProvider = - SdkLoggerProvider.builder() - .setResource(Resource.create(...)) - .addLogProcessor(...) - .build(); -GlobalLoggerProvider.set(sdkLoggerProvider); -``` - In this example Logback log events will be sent to both the console appender and -the `OpenTelemetryAppender`, which will drop the logs until `GlobalLoggerProvider.set(..)` is -called. Once initialized, logs will be emitted to a `Logger` obtained from the `SdkLoggerProvider`. +the `OpenTelemetryAppender`. diff --git a/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppender.java b/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppender.java index 3ba8376ebafe..b161d54d6009 100644 --- a/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppender.java +++ b/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppender.java @@ -9,7 +9,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.UnsynchronizedAppenderBase; -import io.opentelemetry.api.logs.GlobalLoggerProvider; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.logback.appender.v1_0.internal.LoggingEventMapper; import java.util.Arrays; import java.util.List; @@ -42,7 +42,7 @@ public void start() { @Override protected void append(ILoggingEvent event) { - mapper.emit(GlobalLoggerProvider.get(), event); + mapper.emit(GlobalOpenTelemetry.get().getLogsBridge(), event); } /** diff --git a/instrumentation/logback/logback-appender-1.0/library/src/slf4j2ApiTest/java/io/opentelemetry/instrumentation/logback/appender/v1_0/Slf4j2Test.java b/instrumentation/logback/logback-appender-1.0/library/src/slf4j2ApiTest/java/io/opentelemetry/instrumentation/logback/appender/v1_0/Slf4j2Test.java index 6a10618a6e24..80734e80fc02 100644 --- a/instrumentation/logback/logback-appender-1.0/library/src/slf4j2ApiTest/java/io/opentelemetry/instrumentation/logback/appender/v1_0/Slf4j2Test.java +++ b/instrumentation/logback/logback-appender-1.0/library/src/slf4j2ApiTest/java/io/opentelemetry/instrumentation/logback/appender/v1_0/Slf4j2Test.java @@ -7,8 +7,9 @@ import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.logs.GlobalLoggerProvider; +import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.data.LogRecordData; @@ -43,8 +44,8 @@ static void setupAll() { .addLogRecordProcessor(SimpleLogRecordProcessor.create(logRecordExporter)) .build(); - GlobalLoggerProvider.resetForTest(); - GlobalLoggerProvider.set(loggerProvider); + GlobalOpenTelemetry.resetForTest(); + GlobalOpenTelemetry.set(OpenTelemetrySdk.builder().setLoggerProvider(loggerProvider).build()); } @BeforeEach diff --git a/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppenderConfigTest.java b/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppenderConfigTest.java index cc36d6127f19..2fc5271141a8 100644 --- a/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppenderConfigTest.java +++ b/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/OpenTelemetryAppenderConfigTest.java @@ -7,12 +7,13 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.context.Scope; +import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.data.LogRecordData; @@ -54,8 +55,8 @@ static void setupAll() { .addLogRecordProcessor(SimpleLogRecordProcessor.create(logRecordExporter)) .build(); - GlobalLoggerProvider.resetForTest(); - GlobalLoggerProvider.set(loggerProvider); + GlobalOpenTelemetry.resetForTest(); + GlobalOpenTelemetry.set(OpenTelemetrySdk.builder().setLoggerProvider(loggerProvider).build()); } @BeforeEach diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java index f1b6ef95b47f..184b0ef819ea 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ApplicationOpenTelemetry.java @@ -10,6 +10,7 @@ import application.io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.propagation.ApplicationContextPropagators; import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.ApplicationTracerProvider; +import javax.annotation.Nullable; // Our convention for accessing agent package @SuppressWarnings("UnnecessarilyFullyQualified") @@ -18,15 +19,9 @@ public class ApplicationOpenTelemetry implements OpenTelemetry { public static final OpenTelemetry INSTANCE; static { - OpenTelemetry instance = null; - try { - // this class is defined in opentelemetry-api-1.10 - Class clazz = - Class.forName( - "io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.ApplicationOpenTelemetry110"); - instance = (OpenTelemetry) clazz.getField("INSTANCE").get(null); - } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException exception) { - // fall through + OpenTelemetry instance = getOpenTelemetry127(); + if (instance == null) { + instance = getOpenTelemetry110(); } if (instance == null) { instance = new ApplicationOpenTelemetry(); @@ -56,4 +51,30 @@ public TracerProvider getTracerProvider() { public ContextPropagators getPropagators() { return applicationContextPropagators; } + + @Nullable + private static OpenTelemetry getOpenTelemetry127() { + try { + // this class is defined in opentelemetry-api-1.27 + Class clazz = + Class.forName( + "io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.ApplicationOpenTelemetry127"); + return (OpenTelemetry) clazz.getField("INSTANCE").get(null); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException exception) { + return null; + } + } + + @Nullable + private static OpenTelemetry getOpenTelemetry110() { + try { + // this class is defined in opentelemetry-api-1.10 + Class clazz = + Class.forName( + "io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.ApplicationOpenTelemetry110"); + return (OpenTelemetry) clazz.getField("INSTANCE").get(null); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException exception) { + return null; + } + } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java index 8426fc2ac9d1..0c8d94ad8e42 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java @@ -16,7 +16,7 @@ import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_4.trace.ApplicationTracerProvider14; import java.lang.reflect.InvocationTargetException; -public final class ApplicationOpenTelemetry110 implements OpenTelemetry { +public class ApplicationOpenTelemetry110 implements OpenTelemetry { // Accessed with reflection @SuppressWarnings("unused") @@ -27,7 +27,7 @@ public final class ApplicationOpenTelemetry110 implements OpenTelemetry { private final MeterProvider applicationMeterProvider; @SuppressWarnings("UnnecessarilyFullyQualified") - private ApplicationOpenTelemetry110() { + protected ApplicationOpenTelemetry110() { io.opentelemetry.api.OpenTelemetry agentOpenTelemetry = io.opentelemetry.api.GlobalOpenTelemetry.get(); applicationTracerProvider = diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts new file mode 100644 index 000000000000..fd89755d62b1 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + id("otel.javaagent-instrumentation") +} + +dependencies { + compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "v1_27")) + 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")) +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java new file mode 100644 index 000000000000..b4b8c0010882 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java @@ -0,0 +1,32 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27; + +import application.io.opentelemetry.api.OpenTelemetry; +import application.io.opentelemetry.api.logs.LoggerProvider; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.ApplicationOpenTelemetry110; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs.ApplicationLoggerProvider; + +public final class ApplicationOpenTelemetry127 extends ApplicationOpenTelemetry110 { + + // Accessed with reflection + @SuppressWarnings("unused") + public static final OpenTelemetry INSTANCE = new ApplicationOpenTelemetry127(); + + private final LoggerProvider applicationLoggerProvider; + + @SuppressWarnings("UnnecessarilyFullyQualified") + private ApplicationOpenTelemetry127() { + io.opentelemetry.api.OpenTelemetry agentOpenTelemetry = + io.opentelemetry.api.GlobalOpenTelemetry.get(); + applicationLoggerProvider = new ApplicationLoggerProvider(agentOpenTelemetry.getLogsBridge()); + } + + @Override + public LoggerProvider getLogsBridge() { + return applicationLoggerProvider; + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryApiLogsInstrumentationModule.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryApiInstrumentationModule.java similarity index 61% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryApiLogsInstrumentationModule.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryApiInstrumentationModule.java index d7553b977ea2..1949f24cd1ef 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryApiLogsInstrumentationModule.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryApiInstrumentationModule.java @@ -3,22 +3,23 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27; + +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.Collections; import java.util.List; @AutoService(InstrumentationModule.class) -public class OpenTelemetryApiLogsInstrumentationModule extends InstrumentationModule { - public OpenTelemetryApiLogsInstrumentationModule() { - super("opentelemetry-api-logs"); +public class OpenTelemetryApiInstrumentationModule extends InstrumentationModule { + public OpenTelemetryApiInstrumentationModule() { + super("opentelemetry-api", "opentelemetry-api-1.27"); } @Override public List typeInstrumentations() { - return Collections.singletonList(new OpenTelemetryLogsInstrumentation()); + return singletonList(new OpenTelemetryInstrumentation()); } } diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryInstrumentation.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryInstrumentation.java new file mode 100644 index 000000000000..aca23aada696 --- /dev/null +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/OpenTelemetryInstrumentation.java @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27; + +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.none; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; + +public class OpenTelemetryInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("application.io.opentelemetry.api.GlobalOpenTelemetry"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + none(), OpenTelemetryInstrumentation.class.getName() + "$InitAdvice"); + } + + @SuppressWarnings({"ReturnValueIgnored", "unused"}) + public static class InitAdvice { + @Advice.OnMethodEnter + public static void init() { + // the sole purpose of this advice is to ensure that ApplicationOpenTelemetry127 is recognized + // as helper class and injected into class loader + ApplicationOpenTelemetry127.class.getName(); + } + } +} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLogRecordBuilder.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLogRecordBuilder.java similarity index 99% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLogRecordBuilder.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLogRecordBuilder.java index 8e41f6950399..1060663c7d9f 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLogRecordBuilder.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLogRecordBuilder.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs.bridge; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs; import application.io.opentelemetry.api.common.AttributeKey; import application.io.opentelemetry.api.logs.LogRecordBuilder; diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLogger.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLogger.java similarity index 97% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLogger.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLogger.java index ee38e14dff47..7bfe4898ff0f 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLogger.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLogger.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs.bridge; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs; import application.io.opentelemetry.api.logs.LogRecordBuilder; import application.io.opentelemetry.api.logs.Logger; diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLoggerBuilder.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLoggerBuilder.java similarity index 98% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLoggerBuilder.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLoggerBuilder.java index 53b83ebce982..995697f2aa4a 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLoggerBuilder.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLoggerBuilder.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs.bridge; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs; import application.io.opentelemetry.api.logs.Logger; import application.io.opentelemetry.api.logs.LoggerBuilder; diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLoggerProvider.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLoggerProvider.java similarity index 75% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLoggerProvider.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLoggerProvider.java index d5a822c3b7f1..192f53efbc95 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/ApplicationLoggerProvider.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/ApplicationLoggerProvider.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs.bridge; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs; import application.io.opentelemetry.api.logs.LoggerBuilder; import application.io.opentelemetry.api.logs.LoggerProvider; @@ -12,12 +12,10 @@ @SuppressWarnings("UnnecessarilyFullyQualified") public class ApplicationLoggerProvider implements LoggerProvider { - public static final LoggerProvider INSTANCE = new ApplicationLoggerProvider(); - private final io.opentelemetry.api.logs.LoggerProvider agentLoggerProvider; - public ApplicationLoggerProvider() { - this.agentLoggerProvider = io.opentelemetry.api.logs.GlobalLoggerProvider.get(); + public ApplicationLoggerProvider(io.opentelemetry.api.logs.LoggerProvider agentLoggerProvider) { + this.agentLoggerProvider = agentLoggerProvider; } @Override diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/LogBridging.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/LogBridging.java similarity index 98% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/LogBridging.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/LogBridging.java index a6459dddd9d9..2e627b249fe3 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/bridge/LogBridging.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/logs/LogBridging.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs.bridge; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs; import application.io.opentelemetry.api.logs.Severity; import java.util.EnumMap; diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/LoggerTest.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/LoggerTest.java similarity index 96% rename from instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/LoggerTest.java rename to instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/LoggerTest.java index 76b70af3582f..3149502caec1 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/LoggerTest.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/LoggerTest.java @@ -3,14 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs; +package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.Logger; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.api.trace.Span; @@ -39,7 +39,8 @@ class LoggerTest { void setupLogger(TestInfo test) { instrumentationName = "test-" + test.getDisplayName(); logger = - GlobalLoggerProvider.get() + GlobalOpenTelemetry.get() + .getLogsBridge() .loggerBuilder(instrumentationName) .setInstrumentationVersion("1.2.3") .setSchemaUrl("http://schema.org") diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts b/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts deleted file mode 100644 index a6cf2d89e357..000000000000 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/build.gradle.kts +++ /dev/null @@ -1,27 +0,0 @@ -plugins { - id("otel.javaagent-instrumentation") -} - -dependencies { - // this instrumentation needs to be able to reference both the OpenTelemetry API - // that is shaded in the bootstrap class loader (for sending telemetry to the agent), - // and the OpenTelemetry API that the user brings (in order to capture that telemetry) - // - // since (all) instrumentation already uses OpenTelemetry API for sending telemetry to the agent, - // this instrumentation uses a "temporarily shaded" OpenTelemetry API to represent the - // OpenTelemetry API that the user brings - // - // then later, after the OpenTelemetry API in the bootstrap class loader is shaded, - // the "temporarily shaded" OpenTelemetry API is unshaded, so that it will apply to the - // OpenTelemetry API that the user brings - // - // so in the code "application.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that - // the application brings (as those references will be translated during the build to remove the - // "application." prefix) - // - // and in the code "io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is used by - // the agent (as those references will later be shaded) - compileOnly("io.opentelemetry:opentelemetry-api") - compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "shadow")) - implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent")) -} diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryLogsInstrumentation.java b/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryLogsInstrumentation.java deleted file mode 100644 index baac74a958ff..000000000000 --- a/instrumentation/opentelemetry-api/opentelemetry-api-logs-1.23/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/logs/OpenTelemetryLogsInstrumentation.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs; - -import static net.bytebuddy.matcher.ElementMatchers.isMethod; -import static net.bytebuddy.matcher.ElementMatchers.isStatic; -import static net.bytebuddy.matcher.ElementMatchers.named; -import static net.bytebuddy.matcher.ElementMatchers.takesArguments; - -import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; -import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.logs.bridge.ApplicationLoggerProvider; -import net.bytebuddy.asm.Advice; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.matcher.ElementMatcher; - -// Our convention for accessing agent package -@SuppressWarnings("UnnecessarilyFullyQualified") -public class OpenTelemetryLogsInstrumentation implements TypeInstrumentation { - - @Override - public ElementMatcher typeMatcher() { - return named("application.io.opentelemetry.api.logs.GlobalLoggerProvider"); - } - - @Override - public void transform(TypeTransformer transformer) { - transformer.applyAdviceToMethod( - isMethod().and(isStatic()).and(named("get")).and(takesArguments(0)), - OpenTelemetryLogsInstrumentation.class.getName() + "$GetGlobalLogsAdvice"); - } - - @SuppressWarnings("unused") - public static class GetGlobalLogsAdvice { - - @Advice.OnMethodEnter(skipOn = Advice.OnDefaultValue.class) - public static Object onEnter() { - return null; - } - - @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) - public static void methodExit( - @Advice.Return(readOnly = false) - application.io.opentelemetry.api.logs.LoggerProvider loggerProvider) { - loggerProvider = ApplicationLoggerProvider.INSTANCE; - } - } -} diff --git a/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy b/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy index bcd170ad2c11..d81238353cff 100644 --- a/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy +++ b/instrumentation/pulsar/pulsar-2.8/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.groovy @@ -9,7 +9,14 @@ import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import org.apache.pulsar.client.admin.PulsarAdmin -import org.apache.pulsar.client.api.* +import org.apache.pulsar.client.api.Consumer +import org.apache.pulsar.client.api.Message +import org.apache.pulsar.client.api.MessageListener +import org.apache.pulsar.client.api.Messages +import org.apache.pulsar.client.api.Producer +import org.apache.pulsar.client.api.PulsarClient +import org.apache.pulsar.client.api.Schema +import org.apache.pulsar.client.api.SubscriptionInitialPosition import org.slf4j.Logger import org.slf4j.LoggerFactory import org.testcontainers.containers.PulsarContainer @@ -23,13 +30,15 @@ import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import java.util.regex.Pattern -import static io.opentelemetry.api.trace.SpanKind.* +import static io.opentelemetry.api.trace.SpanKind.CONSUMER +import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.SpanKind.PRODUCER class PulsarClientTest extends AgentInstrumentationSpecification { private static final Logger logger = LoggerFactory.getLogger(PulsarClientTest) private static final DockerImageName DEFAULT_IMAGE_NAME = - DockerImageName.parse("apachepulsar/pulsar:2.8.0") + DockerImageName.parse("apachepulsar/pulsar:2.8.0") @Shared private PulsarContainer pulsar @@ -52,9 +61,9 @@ class PulsarClientTest extends AgentInstrumentationSpecification { @Override def setupSpec() { pulsar = new PulsarContainer(DEFAULT_IMAGE_NAME) - .withEnv("PULSAR_MEM", "-Xmx128m") - .withLogConsumer(new Slf4jLogConsumer(logger)) - .withStartupTimeout(Duration.ofMinutes(2)) + .withEnv("PULSAR_MEM", "-Xmx128m") + .withLogConsumer(new Slf4jLogConsumer(logger)) + .withStartupTimeout(Duration.ofMinutes(2)) pulsar.start() brokerHost = pulsar.host @@ -78,8 +87,8 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testSendNonPartitionedTopic" admin.topics().createNonPartitionedTopic(topic) producer = - client.newProducer(Schema.STRING).topic(topic) - .enableBatching(false).create() + client.newProducer(Schema.STRING).topic(topic) + .enableBatching(false).create() when: String msg = "test" @@ -106,22 +115,22 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(1) admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -151,15 +160,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallReceive" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -189,15 +198,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallReceiveAsync" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: CompletableFuture> result = consumer.receiveAsync().whenComplete { receivedMsg, throwable -> @@ -239,15 +248,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallReceiveWithTimeout" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -277,15 +286,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallBatchReceive" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -326,15 +335,15 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testConsumeNonPartitionedTopicCallBatchReceiveAsync" admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -387,22 +396,22 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(1) admin.topics().createNonPartitionedTopic(topic) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .topic(topic) - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .subscriptionName("test_sub") + .topic(topic) + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -432,8 +441,8 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def topic = "persistent://public/default/testSendPartitionedTopic" admin.topics().createPartitionedTopic(topic, 2) producer = - client.newProducer(Schema.STRING).topic(topic) - .enableBatching(false).create() + client.newProducer(Schema.STRING).topic(topic) + .enableBatching(false).create() when: String msg = "test" @@ -461,22 +470,22 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(1) consumer = client.newConsumer(Schema.STRING) - .subscriptionName("test_sub") - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .topic(topic) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .subscriptionName("test_sub") + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .topic(topic) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() producer = client.newProducer(Schema.STRING) - .topic(topic) - .enableBatching(false) - .create() + .topic(topic) + .enableBatching(false) + .create() when: def msg = "test" @@ -495,7 +504,7 @@ class PulsarClientTest extends AgentInstrumentationSpecification { hasNoParent() } producerSpan(it, 1, span(0), topic, ~/${topic}-partition-.*send/, { it.startsWith(topic) }, msgId) - receiveSpan(it, 2, span(1), topic, ~/${topic}-partition-.*receive/, { it.startsWith(topic) }, msgId) + receiveSpan(it, 2, span(1), topic, ~/${topic}-partition-.*receive/, { it.startsWith(topic) }, msgId) processSpan(it, 3, span(2), topic, ~/${topic}-partition-.*process/, { it.startsWith(topic) }, msgId) } } @@ -510,13 +519,13 @@ class PulsarClientTest extends AgentInstrumentationSpecification { def latch = new CountDownLatch(2) producer = client.newProducer(Schema.STRING) - .topic(topic1) - .enableBatching(false) - .create() + .topic(topic1) + .enableBatching(false) + .create() producer2 = client.newProducer(Schema.STRING) - .topic(topic2) - .enableBatching(false) - .create() + .topic(topic2) + .enableBatching(false) + .create() when: runWithSpan("parent1") { @@ -527,17 +536,17 @@ class PulsarClientTest extends AgentInstrumentationSpecification { } consumer = client.newConsumer(Schema.STRING) - .topic(topic2, topic1) - .subscriptionName("test_sub") - .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) - .messageListener(new MessageListener() { - @Override - void received(Consumer consumer, Message msg) { - consumer.acknowledge(msg) - latch.countDown() - } - }) - .subscribe() + .topic(topic2, topic1) + .subscriptionName("test_sub") + .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) + .messageListener(new MessageListener() { + @Override + void received(Consumer consumer, Message msg) { + consumer.acknowledge(msg) + latch.countDown() + } + }) + .subscribe() latch.await(1, TimeUnit.MINUTES) diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy index c3b3ec1149f4..9245f875a976 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy @@ -3,8 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ - -import com.rabbitmq.client.* +import com.rabbitmq.client.AMQP +import com.rabbitmq.client.Channel +import com.rabbitmq.client.Connection +import com.rabbitmq.client.Consumer +import com.rabbitmq.client.DefaultConsumer +import com.rabbitmq.client.Envelope +import com.rabbitmq.client.GetResponse +import com.rabbitmq.client.ShutdownSignalException import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert @@ -20,7 +26,9 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit -import static io.opentelemetry.api.trace.SpanKind.* +import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.SpanKind.CONSUMER +import static io.opentelemetry.api.trace.SpanKind.PRODUCER import static io.opentelemetry.api.trace.StatusCode.ERROR class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabbitMqTrait { @@ -135,8 +143,8 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb setup: channel.exchangeDeclare(exchangeName, "direct", false) String queueName = (messageCount % 2 == 0) ? - channel.queueDeclare().getQueue() : - channel.queueDeclare("some-queue", false, true, true, null).getQueue() + channel.queueDeclare().getQueue() : + channel.queueDeclare("some-queue", false, true, true, null).getQueue() channel.queueBind(queueName, exchangeName, "") def deliveries = [] @@ -153,8 +161,8 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb (1..messageCount).each { if (setTimestamp) { channel.basicPublish(exchangeName, "", - new AMQP.BasicProperties.Builder().timestamp(new Date()).build(), - "msg $it".getBytes()) + new AMQP.BasicProperties.Builder().timestamp(new Date()).build(), + "msg $it".getBytes()) } else { channel.basicPublish(exchangeName, "", null, "msg $it".getBytes()) } @@ -353,18 +361,18 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb } def rabbitSpan( - TraceAssert trace, - int index, - String exchange, - String routingKey, - String operation, - String resource, - SpanData parentSpan = null, - SpanData linkSpan = null, - Throwable exception = null, - String errorMsg = null, - boolean expectTimestamp = false, - boolean testHeaders = false + TraceAssert trace, + int index, + String exchange, + String routingKey, + String operation, + String resource, + SpanData parentSpan = null, + SpanData linkSpan = null, + Throwable exception = null, + String errorMsg = null, + boolean expectTimestamp = false, + boolean testHeaders = false ) { def spanName = resource diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy index 244b1ba6311b..6b4abf84ea99 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy @@ -27,7 +27,7 @@ class ReactorRabbitMqTest extends AgentInstrumentationSpecification implements W when: sender.declareExchange(ExchangeSpecification.exchange("testExchange")) - .block() + .block() then: noExceptionThrown() diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy index db8cd52558a1..b34fd6551dc1 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.groovy @@ -21,7 +21,9 @@ import spock.lang.Unroll import java.util.concurrent.CompletableFuture import java.util.concurrent.TimeUnit -import static io.opentelemetry.api.trace.SpanKind.* +import static io.opentelemetry.api.trace.SpanKind.CONSUMER +import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.SpanKind.PRODUCER //TODO add tests for propagationEnabled flag @Unroll diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java index 04700b4dfbe7..369a9fd22607 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java @@ -6,7 +6,6 @@ package io.opentelemetry.instrumentation.spring.autoconfigure; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.trace.TracerProvider; import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.instrumentation.spring.autoconfigure.resources.SpringResourceConfigProperties; @@ -83,16 +82,14 @@ public SdkLoggerProvider sdkLoggerProvider( SdkLoggerProviderBuilder loggerProviderBuilder = SdkLoggerProvider.builder(); loggerProviderBuilder.setResource(otelResource); - loggerExportersProvider.getIfAvailable(Collections::emptyList).stream() + loggerExportersProvider + .getIfAvailable(Collections::emptyList) .forEach( loggerExporter -> loggerProviderBuilder.addLogRecordProcessor( BatchLogRecordProcessor.builder(loggerExporter).build())); - SdkLoggerProvider loggerProvider = loggerProviderBuilder.build(); - GlobalLoggerProvider.set(loggerProvider); - - return loggerProvider; + return loggerProviderBuilder.build(); } @Bean diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java index e8a4b1546276..67312508ced8 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java @@ -10,14 +10,12 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.resources.OtelResourceAutoConfiguration; import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.SdkTracerProvider; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -37,11 +35,6 @@ public OpenTelemetry customOpenTelemetry() { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName( "when Application Context contains OpenTelemetry bean should NOT initialize openTelemetry") diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java index 6bd10650947b..3dc05203bf0a 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java @@ -7,9 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,11 +22,6 @@ public class TraceAspectAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, TraceAspectAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when aspects are ENABLED should initialize WithSpanAspect bean") void aspectsEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java index 78f5bfc231e7..b1d0bf4492d5 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.jaeger.JaegerGrpcSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -25,11 +23,6 @@ class JaegerSpanExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, JaegerSpanExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when exporters are ENABLED should initialize JaegerGrpcSpanExporter bean") void exportersEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java index 548d341ba15f..5b1e8355e1ec 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.logging.LoggingMetricExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -24,11 +22,6 @@ class LoggingMetricExporterAutoConfigurationTest { OpenTelemetryAutoConfiguration.class, LoggingMetricExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test void loggingEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java index b2aab55f94db..34abb3200ec2 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.logging.LoggingSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -26,11 +24,6 @@ class LoggingSpanExporterAutoConfigurationTest { OpenTelemetryAutoConfiguration.class, LoggingSpanExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when exporters are ENABLED should initialize LoggingSpanExporter bean") void loggingEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java index 354c3fc686be..540eac6ee217 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -23,11 +21,6 @@ class OtlpLogExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, OtlpLoggerExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test void otlpEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java index 219572efcd0b..67b2365579f0 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -23,11 +21,6 @@ class OtlpMetricExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, OtlpMetricExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test void otlpEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java index d7e6d1829be2..d606aae3adaa 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -25,11 +23,6 @@ class OtlpSpanExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, OtlpSpanExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when exporters are ENABLED should initialize OtlpGrpcSpanExporter bean") void otlpEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java index 3729ad53f04e..7e6aa89a4515 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.exporter.zipkin.ZipkinSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -25,11 +23,6 @@ class ZipkinSpanExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, ZipkinSpanExporterAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when exporters are ENABLED should initialize ZipkinSpanExporter bean") void exportersEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java index d6ca636f7db3..84224f625238 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java @@ -7,9 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,11 +22,6 @@ class RestTemplateAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, RestTemplateAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when httpclients are ENABLED should initialize RestTemplateInterceptor bean") void httpClientsEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java index aaf49f8f33f1..ea90e219014c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java @@ -7,9 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,11 +22,6 @@ class WebClientAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, WebClientAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when httpclients are ENABLED should initialize WebClientBeanPostProcessor bean") void httpClientsEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java index 18d40da93bc4..7e66044cd0db 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java @@ -8,10 +8,8 @@ import static org.assertj.core.api.Assertions.assertThat; import io.micrometer.core.instrument.MeterRegistry; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -25,11 +23,6 @@ class MicrometerShimAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, MicrometerShimAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test void metricsEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java index 00dd4c71f80f..a20162cec993 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,11 +22,6 @@ class PropagationAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, PropagationAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when propagation is ENABLED should initialize PropagationAutoConfiguration bean") void shouldBeConfigured() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java index f835cb68be5b..6c746b0c92be 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java @@ -7,10 +7,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import java.util.Arrays; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,11 +22,6 @@ public class PropagationPropertiesTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, PropagationAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when propagation is SET should set PropagationProperties with given propagators") void hasType() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java index 0ab180d6faec..17506fffe3ed 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java @@ -7,9 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -22,11 +20,6 @@ public class OtelResourceAutoConfigurationTest { AutoConfigurations.of( OtelResourceAutoConfiguration.class, OpenTelemetryAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName( "when otel.springboot.resource.enabled is set to true configuration should be initialized") diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java index ec36d97b7a73..2b882b5cf7ee 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java @@ -8,8 +8,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; -import io.opentelemetry.api.logs.GlobalLoggerProvider; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -21,11 +19,6 @@ public class OtelResourcePropertiesTest { .withPropertyValues("otel.springboot.resource.enabled=true") .withConfiguration(AutoConfigurations.of(OtelResourceAutoConfiguration.class)); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when attributes are SET should set OtelResourceProperties with given attributes") void hasAttributes() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java index 96f4209c599a..93756ae1c4ed 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java @@ -8,8 +8,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; -import io.opentelemetry.api.logs.GlobalLoggerProvider; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -19,11 +17,6 @@ class SpringResourceConfigPropertiesTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); - @BeforeEach - void resetGlobalLoggerProvider() { - GlobalLoggerProvider.resetForTest(); - } - @Test @DisplayName("when map is set in properties in a row it should be available in config") void shouldInitializeAttributesByMapInArow() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java index 26f8f5ea5aba..5383154c80c1 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java @@ -8,7 +8,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeTrue; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import jakarta.servlet.Filter; import org.junit.jupiter.api.BeforeEach; @@ -29,7 +28,6 @@ class WebMvcFilterAutoConfigurationSpring6Test { @BeforeEach void setUp() { assumeTrue(Boolean.getBoolean("testLatestDeps")); - GlobalLoggerProvider.resetForTest(); } @Test diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java index 20420df04f19..6c82ae182315 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java @@ -8,7 +8,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeFalse; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import javax.servlet.Filter; import org.junit.jupiter.api.BeforeEach; @@ -28,7 +27,6 @@ class WebMvcFilterAutoConfigurationTest { @BeforeEach void setUp() { assumeFalse(Boolean.getBoolean("testLatestDeps")); - GlobalLoggerProvider.resetForTest(); } @Test diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy b/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy index eb9581213840..4df661a8b759 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy +++ b/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy @@ -3,11 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 */ - import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.semconv.trace.attributes.SemanticAttributes -import static io.opentelemetry.api.trace.SpanKind.* +import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.SpanKind.CONSUMER +import static io.opentelemetry.api.trace.SpanKind.PRODUCER class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification implements WithRabbitProducerConsumerTrait { def setupSpec() { diff --git a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy index dfaa4bf9945d..ddf49278d9f7 100644 --- a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy +++ b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/groovy/SpringTemplateTest.groovy @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ - import com.google.common.io.Files import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import org.hornetq.api.core.TransportConfiguration @@ -21,7 +20,11 @@ import org.springframework.jms.core.JmsTemplate import org.springframework.jms.core.MessagePostProcessor import spock.lang.Shared -import javax.jms.* +import javax.jms.Connection +import javax.jms.JMSException +import javax.jms.Message +import javax.jms.Session +import javax.jms.TextMessage import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference @@ -66,7 +69,7 @@ class SpringTemplateTest extends AgentInstrumentationSpecification { serverLocator.close() def connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, - new TransportConfiguration(InVMConnectorFactory.name)) + new TransportConfiguration(InVMConnectorFactory.name)) connection = connectionFactory.createConnection() connection.start() @@ -125,10 +128,10 @@ class SpringTemplateTest extends AgentInstrumentationSpecification { receivedMessage.text == "responded!" assertTraces(4) { traces.sort(orderByRootSpanName( - "$destinationName receive", - "$destinationName send", - "(temporary) receive", - "(temporary) send")) + "$destinationName receive", + "$destinationName send", + "(temporary) receive", + "(temporary) send")) trace(0, 1) { consumerSpan(it, 0, destinationName, msgId.get(), null, "receive") diff --git a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy index b9d30e24ba53..1cd7eaf4a046 100644 --- a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy +++ b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ - import com.rabbitmq.client.ConnectionFactory import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.testing.GlobalTraceUtil @@ -26,7 +25,9 @@ import spock.lang.Unroll import java.time.Duration -import static io.opentelemetry.api.trace.SpanKind.* +import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.SpanKind.CONSUMER +import static io.opentelemetry.api.trace.SpanKind.PRODUCER class ContextPropagationTest extends AgentInstrumentationSpecification { @@ -39,23 +40,23 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { def setupSpec() { rabbitMqContainer = new GenericContainer('rabbitmq:latest') - .withExposedPorts(5672) - .waitingFor(Wait.forLogMessage(".*Server startup complete.*", 1)) - .withStartupTimeout(Duration.ofMinutes(2)) + .withExposedPorts(5672) + .waitingFor(Wait.forLogMessage(".*Server startup complete.*", 1)) + .withStartupTimeout(Duration.ofMinutes(2)) rabbitMqContainer.start() def app = new SpringApplication(ConsumerConfig) app.setDefaultProperties([ - "spring.jmx.enabled" : false, - "spring.main.web-application-type": "none", - "spring.rabbitmq.host" : rabbitMqContainer.host, - "spring.rabbitmq.port" : rabbitMqContainer.getMappedPort(5672), + "spring.jmx.enabled" : false, + "spring.main.web-application-type": "none", + "spring.rabbitmq.host" : rabbitMqContainer.host, + "spring.rabbitmq.port" : rabbitMqContainer.getMappedPort(5672), ]) applicationContext = app.run() connectionFactory = new ConnectionFactory( - host: rabbitMqContainer.host, - port: rabbitMqContainer.getMappedPort(5672) + host: rabbitMqContainer.host, + port: rabbitMqContainer.getMappedPort(5672) ) } @@ -74,16 +75,16 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { runWithSpan("parent") { if (testHeaders) { applicationContext.getBean(AmqpTemplate) - .convertAndSend(ConsumerConfig.TEST_QUEUE, (Object) "test", new MessagePostProcessor() { - @Override - Message postProcessMessage(Message message) throws AmqpException { - message.getMessageProperties().setHeader("test-message-header", "test") - return message - } - }) + .convertAndSend(ConsumerConfig.TEST_QUEUE, (Object) "test", new MessagePostProcessor() { + @Override + Message postProcessMessage(Message message) throws AmqpException { + message.getMessageProperties().setHeader("test-message-header", "test") + return message + } + }) } else { applicationContext.getBean(AmqpTemplate) - .convertAndSend(ConsumerConfig.TEST_QUEUE, "test") + .convertAndSend(ConsumerConfig.TEST_QUEUE, "test") } } diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index 2f3e19ee9f54..b531c48cf926 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { implementation(project(":muzzle")) implementation("io.opentelemetry:opentelemetry-api") + implementation("io.opentelemetry:opentelemetry-api-events") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation("io.opentelemetry:opentelemetry-extension-kotlin") diff --git a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy index abd588a679b2..dc3533d55e92 100755 --- a/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy +++ b/javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/tooling/OpenTelemetryInstallerTest.groovy @@ -8,20 +8,17 @@ package io.opentelemetry.javaagent.tooling import io.opentelemetry.api.GlobalOpenTelemetry import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.events.GlobalEventEmitterProvider -import io.opentelemetry.api.logs.GlobalLoggerProvider import spock.lang.Specification class OpenTelemetryInstallerTest extends Specification { void setup() { GlobalOpenTelemetry.resetForTest() - GlobalLoggerProvider.resetForTest() GlobalEventEmitterProvider.resetForTest() } void cleanup() { GlobalOpenTelemetry.resetForTest() - GlobalLoggerProvider.resetForTest() GlobalEventEmitterProvider.resetForTest() } diff --git a/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java b/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java index 8ae6af0cc5e9..5bc5af79faec 100644 --- a/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java +++ b/javaagent-tooling/src/test/java/io/opentelemetry/javaagent/tooling/config/ConfigurationPropertiesSupplierTest.java @@ -11,7 +11,6 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.events.GlobalEventEmitterProvider; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer; @@ -33,7 +32,6 @@ class ConfigurationPropertiesSupplierTest { @AfterAll static void cleanUp() { GlobalOpenTelemetry.resetForTest(); - GlobalLoggerProvider.resetForTest(); GlobalEventEmitterProvider.resetForTest(); } diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts index 63d716a68d7c..2c46e0f4d0ab 100644 --- a/javaagent/build.gradle.kts +++ b/javaagent/build.gradle.kts @@ -221,7 +221,7 @@ tasks { dependsOn(shadowJar, baseJavaagentJar) } - if (findProperty("removeJarVersionNumbers")=="true") { + if (findProperty("removeJarVersionNumbers") == "true") { withType().configureEach { archiveVersion.set("") } diff --git a/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts b/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts index 72e627e7a5a4..6fb5e5f32bb6 100644 --- a/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts +++ b/opentelemetry-api-shaded-for-instrumenting/build.gradle.kts @@ -25,6 +25,12 @@ val v1_15Deps by configurations.creating { // exclude the bom added by dependencyManagement exclude("io.opentelemetry", "opentelemetry-bom") } +val v1_27Deps by configurations.creating { + isCanBeResolved = true + isCanBeConsumed = false + // exclude the bom added by dependencyManagement + exclude("io.opentelemetry", "opentelemetry-bom") +} // configuration for publishing the shadowed artifact val v1_10 by configurations.creating { @@ -35,6 +41,10 @@ val v1_15 by configurations.creating { isCanBeConsumed = true isCanBeResolved = false } +val v1_27 by configurations.creating { + isCanBeConsumed = true + isCanBeResolved = false +} dependencies { latestDeps("io.opentelemetry:opentelemetry-api") @@ -50,6 +60,11 @@ dependencies { strictly("1.15.0") } } + v1_27Deps("io.opentelemetry:$it") { + version { + strictly("1.27.0") + } + } } } @@ -73,9 +88,14 @@ tasks { configurations = listOf(v1_15Deps) archiveClassifier.set("v1_15") } + val v1_27Shadow by registering(ShadowJar::class) { + configurations = listOf(v1_27Deps) + archiveClassifier.set("v1_27") + } artifacts { add(v1_10.name, v1_10Shadow) add(v1_15.name, v1_15Shadow) + add(v1_27.name, v1_27Shadow) } } diff --git a/settings.gradle.kts b/settings.gradle.kts index f3bb19af8e11..ea21f116deca 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -383,7 +383,7 @@ hideFromDependabot(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:jav hideFromDependabot(":instrumentation:opentelemetry-api:opentelemetry-api-1.4:javaagent") hideFromDependabot(":instrumentation:opentelemetry-api:opentelemetry-api-1.10:javaagent") hideFromDependabot(":instrumentation:opentelemetry-api:opentelemetry-api-1.15:javaagent") -hideFromDependabot(":instrumentation:opentelemetry-api:opentelemetry-api-logs-1.23:javaagent") +hideFromDependabot(":instrumentation:opentelemetry-api:opentelemetry-api-1.27:javaagent") hideFromDependabot(":instrumentation:opentelemetry-extension-annotations-1.0:javaagent") hideFromDependabot(":instrumentation:opentelemetry-extension-kotlin-1.0:javaagent") hideFromDependabot(":instrumentation:opentelemetry-instrumentation-annotations-1.16:javaagent") From f9277be50299e67e8e07479fa2a37fb70ea1bac0 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 10 Jun 2023 10:54:33 -0700 Subject: [PATCH 06/17] Fix --- .../javaagent/instrumentation/jul/JavaUtilLoggingTest.java | 2 +- .../jbosslogmanager/appender/v1_1/JbossLogmanagerTest.java | 2 +- .../instrumentation/log4j/appender/v1_2/Log4j1Test.java | 2 +- .../instrumentation/log4j/appender/v2_17/Log4j2Test.java | 2 +- .../instrumentation/log4j/appender/v2_17/Slf4jToLog4jTest.java | 2 +- .../instrumentation/logback/appender/v1_0/LogbackTest.java | 2 +- .../instrumentation/rxjava/v3/common/AbstractRxJava3Test.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/instrumentation/java-util-logging/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingTest.java b/instrumentation/java-util-logging/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingTest.java index 5122483f5552..aec5d7a342d3 100644 --- a/instrumentation/java-util-logging/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingTest.java +++ b/instrumentation/java-util-logging/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.jul; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; diff --git a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/JbossLogmanagerTest.java b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/JbossLogmanagerTest.java index e716a541a5f8..cd3268443659 100644 --- a/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/JbossLogmanagerTest.java +++ b/instrumentation/jboss-logmanager/jboss-logmanager-appender-1.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jbosslogmanager/appender/v1_1/JbossLogmanagerTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.jbosslogmanager.appender.v1_1; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; import static org.assertj.core.api.Assertions.assertThat; diff --git a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v1_2/Log4j1Test.java b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v1_2/Log4j1Test.java index 00a178ab7cdd..f4bd3ae46e65 100644 --- a/instrumentation/log4j/log4j-appender-1.2/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v1_2/Log4j1Test.java +++ b/instrumentation/log4j/log4j-appender-1.2/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v1_2/Log4j1Test.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.log4j.appender.v1_2; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Log4j2Test.java b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Log4j2Test.java index 245b93b55552..4c753b52c4ee 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Log4j2Test.java +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Log4j2Test.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.log4j.appender.v2_17; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Slf4jToLog4jTest.java b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Slf4jToLog4jTest.java index be724d6b9e9f..130069352c62 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Slf4jToLog4jTest.java +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Slf4jToLog4jTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.log4j.appender.v2_17; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; diff --git a/instrumentation/logback/logback-appender-1.0/javaagent/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/LogbackTest.java b/instrumentation/logback/logback-appender-1.0/javaagent/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/LogbackTest.java index fe077bd43fc6..c327677fcd16 100644 --- a/instrumentation/logback/logback-appender-1.0/javaagent/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/LogbackTest.java +++ b/instrumentation/logback/logback-appender-1.0/javaagent/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/LogbackTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.logback.appender.v1_0; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; diff --git a/instrumentation/rxjava/rxjava-3-common/testing/src/main/java/io/opentelemetry/instrumentation/rxjava/v3/common/AbstractRxJava3Test.java b/instrumentation/rxjava/rxjava-3-common/testing/src/main/java/io/opentelemetry/instrumentation/rxjava/v3/common/AbstractRxJava3Test.java index d5471f952477..aea341536897 100644 --- a/instrumentation/rxjava/rxjava-3-common/testing/src/main/java/io/opentelemetry/instrumentation/rxjava/v3/common/AbstractRxJava3Test.java +++ b/instrumentation/rxjava/rxjava-3-common/testing/src/main/java/io/opentelemetry/instrumentation/rxjava/v3/common/AbstractRxJava3Test.java @@ -5,7 +5,7 @@ package io.opentelemetry.instrumentation.rxjava.v3.common; -import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.attributeEntry; import static org.assertj.core.api.Assertions.assertThatThrownBy; From 001a02fb211b7eaf8304eefa09baf4f9a1f1ba9e Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 10 Jun 2023 11:06:33 -0700 Subject: [PATCH 07/17] Fix --- .../instrumentation/jms/MessageWithDestination.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java b/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java index 2a6e0066d073..d394a77427bd 100644 --- a/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java +++ b/instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java @@ -38,7 +38,7 @@ public static MessageWithDestination create( return createMessageWithTopic(message, jmsDestination); } return new AutoValue_MessageWithDestination( - message, "unknown", "unknown", /* isTemporaryDestination= */ false); + message, "unknown", /* isTemporaryDestination= */ false); } private static MessageWithDestination createMessageWithQueue( @@ -47,7 +47,7 @@ private static MessageWithDestination createMessageWithQueue( String queueName = getDestinationName(queue, DestinationAdapter::getQueueName); boolean temporary = queue.isTemporaryQueue() || queueName.startsWith(TIBCO_TMP_PREFIX); - return new AutoValue_MessageWithDestination(message, queueName, "queue", temporary); + return new AutoValue_MessageWithDestination(message, queueName, temporary); } private static MessageWithDestination createMessageWithTopic( @@ -56,7 +56,7 @@ private static MessageWithDestination createMessageWithTopic( String topicName = getDestinationName(topic, DestinationAdapter::getTopicName); boolean temporary = topic.isTemporaryTopic() || topicName.startsWith(TIBCO_TMP_PREFIX); - return new AutoValue_MessageWithDestination(message, topicName, "topic", temporary); + return new AutoValue_MessageWithDestination(message, topicName, temporary); } private static String getDestinationName(DestinationAdapter destination, NameGetter nameGetter) { From 9481cdcc18294099f58df00c4f2b9e6dc0a6f17a Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 10 Jun 2023 11:49:29 -0700 Subject: [PATCH 08/17] Fix --- .../jms/MessageWithDestinationTest.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java b/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java index 4f28fcec6937..ccd7e39d2be0 100644 --- a/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java +++ b/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java @@ -34,7 +34,7 @@ void shouldCreateMessageWithUnknownDestination() throws Exception { MessageWithDestination result = MessageWithDestination.create(message, null); // then - assertMessage("unknown", "unknown", /* expectedTemporary= */ false, result); + assertMessage("unknown", /* expectedTemporary= */ false, result); } @Test @@ -46,7 +46,7 @@ void shouldUseFallbackDestinationToCreateMessage() throws Exception { MessageWithDestination result = MessageWithDestination.create(message, destination); // then - assertMessage("unknown", "unknown", /* expectedTemporary= */ false, result); + assertMessage( "unknown", /* expectedTemporary= */ false, result); } @ParameterizedTest @@ -73,7 +73,7 @@ void shouldCreateMessageWithQueue( MessageWithDestination result = MessageWithDestination.create(message, null); // then - assertMessage("queue", expectedDestinationName, expectedTemporary, result); + assertMessage(expectedDestinationName, expectedTemporary, result); } @ParameterizedTest @@ -100,7 +100,7 @@ void shouldCreateMessageWithTopic( MessageWithDestination result = MessageWithDestination.create(message, null); // then - assertMessage("topic", expectedDestinationName, expectedTemporary, result); + assertMessage(expectedDestinationName, expectedTemporary, result); } static Stream destinations() { @@ -112,13 +112,11 @@ static Stream destinations() { } private void assertMessage( - String expectedDestinationKind, String expectedDestinationName, boolean expectedTemporary, MessageWithDestination actual) { assertSame(message, actual.message()); - assertEquals(expectedDestinationKind, actual.destinationKind()); assertEquals(expectedDestinationName, actual.destinationName()); assertEquals(expectedTemporary, actual.isTemporaryDestination()); } From 8b96c6da00e8bdfb6699e8f661cfa42e7233f43a Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 10 Jun 2023 12:48:02 -0700 Subject: [PATCH 09/17] Spotless --- .../instrumentation/jms/MessageWithDestinationTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java b/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java index ccd7e39d2be0..b76091d203fa 100644 --- a/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java +++ b/instrumentation/jms/jms-common/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestinationTest.java @@ -46,7 +46,7 @@ void shouldUseFallbackDestinationToCreateMessage() throws Exception { MessageWithDestination result = MessageWithDestination.create(message, destination); // then - assertMessage( "unknown", /* expectedTemporary= */ false, result); + assertMessage("unknown", /* expectedTemporary= */ false, result); } @ParameterizedTest @@ -112,9 +112,7 @@ static Stream destinations() { } private void assertMessage( - String expectedDestinationName, - boolean expectedTemporary, - MessageWithDestination actual) { + String expectedDestinationName, boolean expectedTemporary, MessageWithDestination actual) { assertSame(message, actual.message()); assertEquals(expectedDestinationName, actual.destinationName()); From e558857a022005fcb94d033fc1ec05678cdba109 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 10 Jun 2023 15:28:09 -0700 Subject: [PATCH 10/17] Consistency --- .../v1_10/ApplicationOpenTelemetry110.java | 4 +-- .../v1_27/ApplicationOpenTelemetry127.java | 34 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java index 0c8d94ad8e42..8426fc2ac9d1 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.10/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_10/ApplicationOpenTelemetry110.java @@ -16,7 +16,7 @@ import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_4.trace.ApplicationTracerProvider14; import java.lang.reflect.InvocationTargetException; -public class ApplicationOpenTelemetry110 implements OpenTelemetry { +public final class ApplicationOpenTelemetry110 implements OpenTelemetry { // Accessed with reflection @SuppressWarnings("unused") @@ -27,7 +27,7 @@ public class ApplicationOpenTelemetry110 implements OpenTelemetry { private final MeterProvider applicationMeterProvider; @SuppressWarnings("UnnecessarilyFullyQualified") - protected ApplicationOpenTelemetry110() { + private ApplicationOpenTelemetry110() { io.opentelemetry.api.OpenTelemetry agentOpenTelemetry = io.opentelemetry.api.GlobalOpenTelemetry.get(); applicationTracerProvider = diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java index b4b8c0010882..2c9c8e3aa37b 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java @@ -7,26 +7,56 @@ import application.io.opentelemetry.api.OpenTelemetry; import application.io.opentelemetry.api.logs.LoggerProvider; -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.ApplicationOpenTelemetry110; +import application.io.opentelemetry.api.metrics.MeterProvider; +import application.io.opentelemetry.api.trace.TracerProvider; +import application.io.opentelemetry.context.propagation.ContextPropagators; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.propagation.ApplicationContextPropagators; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationMeterProvider; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_15.metrics.ApplicationMeterFactory115; import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_27.logs.ApplicationLoggerProvider; +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_4.trace.ApplicationTracerProvider14; -public final class ApplicationOpenTelemetry127 extends ApplicationOpenTelemetry110 { +public final class ApplicationOpenTelemetry127 implements OpenTelemetry { // Accessed with reflection @SuppressWarnings("unused") public static final OpenTelemetry INSTANCE = new ApplicationOpenTelemetry127(); + private final TracerProvider applicationTracerProvider; + private final ContextPropagators applicationContextPropagators; + private final MeterProvider applicationMeterProvider; private final LoggerProvider applicationLoggerProvider; @SuppressWarnings("UnnecessarilyFullyQualified") private ApplicationOpenTelemetry127() { io.opentelemetry.api.OpenTelemetry agentOpenTelemetry = io.opentelemetry.api.GlobalOpenTelemetry.get(); + applicationTracerProvider = + new ApplicationTracerProvider14(agentOpenTelemetry.getTracerProvider()); + applicationContextPropagators = + new ApplicationContextPropagators(agentOpenTelemetry.getPropagators()); + applicationMeterProvider = + new ApplicationMeterProvider(new ApplicationMeterFactory115(), agentOpenTelemetry.getMeterProvider()); applicationLoggerProvider = new ApplicationLoggerProvider(agentOpenTelemetry.getLogsBridge()); } + @Override + public TracerProvider getTracerProvider() { + return applicationTracerProvider; + } + + @Override + public MeterProvider getMeterProvider() { + return applicationMeterProvider; + } + @Override public LoggerProvider getLogsBridge() { return applicationLoggerProvider; } + + @Override + public ContextPropagators getPropagators() { + return applicationContextPropagators; + } } From b02832414104f4ea6eab9f63f6757055d3934859 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sat, 10 Jun 2023 15:31:02 -0700 Subject: [PATCH 11/17] small revert --- javaagent-tooling/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index b531c48cf926..2f3e19ee9f54 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { implementation(project(":muzzle")) implementation("io.opentelemetry:opentelemetry-api") - implementation("io.opentelemetry:opentelemetry-api-events") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation("io.opentelemetry:opentelemetry-extension-kotlin") From 606c722ea0b560bcf3025b1c09bafa7bad3df8c6 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Sun, 11 Jun 2023 13:15:59 +0300 Subject: [PATCH 12/17] spotless --- .../opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java index 2c9c8e3aa37b..2b66f448dd78 100644 --- a/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java +++ b/instrumentation/opentelemetry-api/opentelemetry-api-1.27/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_27/ApplicationOpenTelemetry127.java @@ -36,7 +36,8 @@ private ApplicationOpenTelemetry127() { applicationContextPropagators = new ApplicationContextPropagators(agentOpenTelemetry.getPropagators()); applicationMeterProvider = - new ApplicationMeterProvider(new ApplicationMeterFactory115(), agentOpenTelemetry.getMeterProvider()); + new ApplicationMeterProvider( + new ApplicationMeterFactory115(), agentOpenTelemetry.getMeterProvider()); applicationLoggerProvider = new ApplicationLoggerProvider(agentOpenTelemetry.getLogsBridge()); } From abbcf76d10d95e33783a18954039bec25fa298bc Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Sun, 11 Jun 2023 13:16:17 +0300 Subject: [PATCH 13/17] add opentelemetry-api-events dependency --- javaagent-tooling/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index 2f3e19ee9f54..b531c48cf926 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { implementation(project(":muzzle")) implementation("io.opentelemetry:opentelemetry-api") + implementation("io.opentelemetry:opentelemetry-api-events") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation("io.opentelemetry:opentelemetry-extension-kotlin") From 720a84f33411d04eabbdab8d242f64502cd128c0 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 12 Jun 2023 07:53:51 -0700 Subject: [PATCH 14/17] Deprecation cycle --- .../messaging/MessagingAttributesGetter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java index 18d1899a08ba..87e7893dfeff 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java @@ -22,6 +22,16 @@ public interface MessagingAttributesGetter { @Nullable String getSystem(REQUEST request); + /** + * @deprecated This method is deprecated and will be removed in a future release. + * There is no replacement for this concept. + */ + @Nullable + @Deprecated + default String getDestinationKind(REQUEST request) { + return null; + } + @Nullable String getDestination(REQUEST request); From 07bd2212d56296518e5f03ae0c98bc3bb698e04b Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 12 Jun 2023 08:00:08 -0700 Subject: [PATCH 15/17] testImplementation --- javaagent-tooling/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index b531c48cf926..cbce3b82d7db 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { implementation(project(":muzzle")) implementation("io.opentelemetry:opentelemetry-api") - implementation("io.opentelemetry:opentelemetry-api-events") + testImplementation("io.opentelemetry:opentelemetry-api-events") implementation("io.opentelemetry:opentelemetry-sdk") implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation("io.opentelemetry:opentelemetry-extension-kotlin") From 7fcb2961786e37a26c5271d1edcf79ac04c9dbbf Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 12 Jun 2023 13:48:21 -0700 Subject: [PATCH 16/17] Spotless --- .../api/instrumenter/messaging/MessagingAttributesGetter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java index 87e7893dfeff..71ffc8a3a0e9 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesGetter.java @@ -23,8 +23,8 @@ public interface MessagingAttributesGetter { String getSystem(REQUEST request); /** - * @deprecated This method is deprecated and will be removed in a future release. - * There is no replacement for this concept. + * @deprecated This method is deprecated and will be removed in a future release. There is no + * replacement for this concept. */ @Nullable @Deprecated From 2249ae90f6d10ff987d9c0773194586e3143be01 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 12 Jun 2023 15:08:12 -0700 Subject: [PATCH 17/17] global --- .../autoconfigure/OpenTelemetryAutoConfiguration.java | 4 ++++ .../autoconfigure/OpenTelemetryAutoConfigurationTest.java | 7 +++++++ .../aspects/TraceAspectAutoConfigurationTest.java | 7 +++++++ .../jaeger/JaegerSpanExporterAutoConfigurationTest.java | 7 +++++++ .../LoggingMetricExporterAutoConfigurationTest.java | 7 +++++++ .../logging/LoggingSpanExporterAutoConfigurationTest.java | 7 +++++++ .../otlp/OtlpLogExporterAutoConfigurationTest.java | 7 +++++++ .../otlp/OtlpMetricExporterAutoConfigurationTest.java | 7 +++++++ .../otlp/OtlpSpanExporterAutoConfigurationTest.java | 7 +++++++ .../zipkin/ZipkinSpanExporterAutoConfigurationTest.java | 7 +++++++ .../resttemplate/RestTemplateAutoConfigurationTest.java | 7 +++++++ .../webclient/WebClientAutoConfigurationTest.java | 7 +++++++ .../metrics/MicrometerShimAutoConfigurationTest.java | 7 +++++++ .../propagators/PropagationAutoConfigurationTest.java | 7 +++++++ .../propagators/PropagationPropertiesTest.java | 7 +++++++ .../resources/OtelResourceAutoConfigurationTest.java | 7 +++++++ .../resources/OtelResourcePropertiesTest.java | 7 +++++++ .../resources/SpringResourceConfigPropertiesTest.java | 7 +++++++ .../webmvc/WebMvcFilterAutoConfigurationSpring6Test.java | 2 ++ .../webmvc/WebMvcFilterAutoConfigurationTest.java | 2 ++ 20 files changed, 127 insertions(+) diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java index 369a9fd22607..68e1e5be6121 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.spring.autoconfigure; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.TracerProvider; import io.opentelemetry.context.propagation.ContextPropagators; @@ -140,6 +141,9 @@ public OpenTelemetry openTelemetry( ContextPropagators propagators = propagatorsProvider.getIfAvailable(ContextPropagators::noop); + // global is needed for logging appenders + GlobalOpenTelemetry.set(OpenTelemetrySdk.builder().setLoggerProvider(loggerProvider).build()); + return OpenTelemetrySdk.builder() .setTracerProvider(tracerProvider) .setMeterProvider(meterProvider) diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java index 67312508ced8..35809251e5c8 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfigurationTest.java @@ -8,6 +8,7 @@ import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_NAME; import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.spring.autoconfigure.resources.OtelResourceAutoConfiguration; @@ -16,6 +17,7 @@ import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.SdkTracerProvider; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -35,6 +37,11 @@ public OpenTelemetry customOpenTelemetry() { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName( "when Application Context contains OpenTelemetry bean should NOT initialize openTelemetry") diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java index 3dc05203bf0a..0f61763ac496 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/aspects/TraceAspectAutoConfigurationTest.java @@ -7,7 +7,9 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -22,6 +24,11 @@ public class TraceAspectAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, TraceAspectAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when aspects are ENABLED should initialize WithSpanAspect bean") void aspectsEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java index b1d0bf4492d5..b46645121c17 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/jaeger/JaegerSpanExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.jaeger.JaegerGrpcSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -23,6 +25,11 @@ class JaegerSpanExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, JaegerSpanExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when exporters are ENABLED should initialize JaegerGrpcSpanExporter bean") void exportersEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java index 5b1e8355e1ec..62e30cdd899c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingMetricExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.logging.LoggingMetricExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -22,6 +24,11 @@ class LoggingMetricExporterAutoConfigurationTest { OpenTelemetryAutoConfiguration.class, LoggingMetricExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test void loggingEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java index 34abb3200ec2..3f0f9c2a20fa 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/logging/LoggingSpanExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.logging.LoggingSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,6 +26,11 @@ class LoggingSpanExporterAutoConfigurationTest { OpenTelemetryAutoConfiguration.class, LoggingSpanExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when exporters are ENABLED should initialize LoggingSpanExporter bean") void loggingEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java index 540eac6ee217..8fde124356ab 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpLogExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -21,6 +23,11 @@ class OtlpLogExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, OtlpLoggerExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test void otlpEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java index 67b2365579f0..9b8ac94017c4 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpMetricExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -21,6 +23,11 @@ class OtlpMetricExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, OtlpMetricExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test void otlpEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java index d606aae3adaa..108afea8856d 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/otlp/OtlpSpanExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -23,6 +25,11 @@ class OtlpSpanExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, OtlpSpanExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when exporters are ENABLED should initialize OtlpGrpcSpanExporter bean") void otlpEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java index 7e6aa89a4515..f5120be939b1 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/exporters/zipkin/ZipkinSpanExporterAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.exporter.zipkin.ZipkinSpanExporter; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -23,6 +25,11 @@ class ZipkinSpanExporterAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, ZipkinSpanExporterAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when exporters are ENABLED should initialize ZipkinSpanExporter bean") void exportersEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java index 84224f625238..3a98e6a3f607 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/resttemplate/RestTemplateAutoConfigurationTest.java @@ -7,7 +7,9 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -22,6 +24,11 @@ class RestTemplateAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, RestTemplateAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when httpclients are ENABLED should initialize RestTemplateInterceptor bean") void httpClientsEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java index ea90e219014c..aaa7fc2468a5 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/httpclients/webclient/WebClientAutoConfigurationTest.java @@ -7,7 +7,9 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -22,6 +24,11 @@ class WebClientAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, WebClientAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when httpclients are ENABLED should initialize WebClientBeanPostProcessor bean") void httpClientsEnabled() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java index 7e66044cd0db..4e62b622ee6b 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/metrics/MicrometerShimAutoConfigurationTest.java @@ -8,8 +8,10 @@ import static org.assertj.core.api.Assertions.assertThat; import io.micrometer.core.instrument.MeterRegistry; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -23,6 +25,11 @@ class MicrometerShimAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, MicrometerShimAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test void metricsEnabled() { runner diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java index a20162cec993..b5bc165f0ced 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationAutoConfigurationTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -22,6 +24,11 @@ class PropagationAutoConfigurationTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, PropagationAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when propagation is ENABLED should initialize PropagationAutoConfiguration bean") void shouldBeConfigured() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java index 6c746b0c92be..7d0dbbe2306c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/propagators/PropagationPropertiesTest.java @@ -7,8 +7,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import java.util.Arrays; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -22,6 +24,11 @@ public class PropagationPropertiesTest { AutoConfigurations.of( OpenTelemetryAutoConfiguration.class, PropagationAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when propagation is SET should set PropagationProperties with given propagators") void hasType() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java index 17506fffe3ed..e0ac7e58320f 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourceAutoConfigurationTest.java @@ -7,7 +7,9 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -20,6 +22,11 @@ public class OtelResourceAutoConfigurationTest { AutoConfigurations.of( OtelResourceAutoConfiguration.class, OpenTelemetryAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName( "when otel.springboot.resource.enabled is set to true configuration should be initialized") diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java index 2b882b5cf7ee..89881bafa64c 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/OtelResourcePropertiesTest.java @@ -8,6 +8,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; +import io.opentelemetry.api.GlobalOpenTelemetry; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -19,6 +21,11 @@ public class OtelResourcePropertiesTest { .withPropertyValues("otel.springboot.resource.enabled=true") .withConfiguration(AutoConfigurations.of(OtelResourceAutoConfiguration.class)); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when attributes are SET should set OtelResourceProperties with given attributes") void hasAttributes() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java index 93756ae1c4ed..969a81d5a369 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/resources/SpringResourceConfigPropertiesTest.java @@ -8,6 +8,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; +import io.opentelemetry.api.GlobalOpenTelemetry; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -17,6 +19,11 @@ class SpringResourceConfigPropertiesTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); + @BeforeEach + void resetGlobalLoggerProvider() { + GlobalOpenTelemetry.resetForTest(); + } + @Test @DisplayName("when map is set in properties in a row it should be available in config") void shouldInitializeAttributesByMapInArow() { diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java index 5383154c80c1..22ab4809381d 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationSpring6Test.java @@ -8,6 +8,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeTrue; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import jakarta.servlet.Filter; import org.junit.jupiter.api.BeforeEach; @@ -28,6 +29,7 @@ class WebMvcFilterAutoConfigurationSpring6Test { @BeforeEach void setUp() { assumeTrue(Boolean.getBoolean("testLatestDeps")); + GlobalOpenTelemetry.resetForTest(); } @Test diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java index 6c82ae182315..4e44a5cbcf54 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java +++ b/instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/webmvc/WebMvcFilterAutoConfigurationTest.java @@ -8,6 +8,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeFalse; +import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; import javax.servlet.Filter; import org.junit.jupiter.api.BeforeEach; @@ -27,6 +28,7 @@ class WebMvcFilterAutoConfigurationTest { @BeforeEach void setUp() { assumeFalse(Boolean.getBoolean("testLatestDeps")); + GlobalOpenTelemetry.resetForTest(); } @Test