From 9c1de50343669baa5b4754c8a9c266fdc914e697 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Wed, 10 Jan 2024 00:44:05 +0200 Subject: [PATCH] Disable jaxws annotation instrumentation when controller telemetry is not enabled (#10193) --- .../jaxws/jaxws-jws-api-1.1/javaagent/build.gradle.kts | 1 + .../jaxws/jws/v1_1/JwsInstrumentationModule.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/build.gradle.kts b/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/build.gradle.kts index 05a2286b28b6..8aa0c204f3e9 100644 --- a/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/build.gradle.kts +++ b/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { library("javax.jws:javax.jws-api:1.1") implementation(project(":instrumentation:jaxws:jaxws-common:javaagent")) } + tasks.withType().configureEach { jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } diff --git a/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/jws/v1_1/JwsInstrumentationModule.java b/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/jws/v1_1/JwsInstrumentationModule.java index 1df371d02b6a..00397767ad08 100644 --- a/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/jws/v1_1/JwsInstrumentationModule.java +++ b/instrumentation/jaxws/jaxws-jws-api-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/jws/v1_1/JwsInstrumentationModule.java @@ -6,8 +6,10 @@ package io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1; import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import java.util.Collections; import java.util.List; @@ -22,4 +24,10 @@ public JwsInstrumentationModule() { public List typeInstrumentations() { return Collections.singletonList(new JwsAnnotationsInstrumentation()); } + + @Override + public boolean defaultEnabled(ConfigProperties config) { + // this instrumentation only produces controller telemetry + return ExperimentalConfig.get().controllerTelemetryEnabled(); + } }