From f1ed419a39f6672b6b1f93aa9ad62b168cf820c4 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 12 Jan 2024 09:19:15 -0800 Subject: [PATCH] Disable lettuce CONNECT spans by default (#10215) Co-authored-by: Lauri Tulmin --- instrumentation/lettuce/README.md | 3 ++- .../lettuce/lettuce-4.0/javaagent/build.gradle.kts | 1 + .../instrumentation/lettuce/v4_0/LettuceSingletons.java | 4 ++++ .../lettuce/lettuce-5.0/javaagent/build.gradle.kts | 1 + .../instrumentation/lettuce/v5_0/LettuceSingletons.java | 4 ++++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/instrumentation/lettuce/README.md b/instrumentation/lettuce/README.md index 55b3eaca49d2..ed102ec06218 100644 --- a/instrumentation/lettuce/README.md +++ b/instrumentation/lettuce/README.md @@ -1,5 +1,6 @@ # Settings for the Lettuce instrumentation | System property | Type | Default | Description | -| ----------------------------------------------------------- | ------- | ------- | --------------------------------------------------- | +|-------------------------------------------------------------|---------|---------|-----------------------------------------------------| | `otel.instrumentation.lettuce.experimental-span-attributes` | Boolean | `false` | Enable the capture of experimental span attributes. | +| `otel.instrumentation.lettuce.connection-telemetry.enabled` | Boolean | `false` | Enable the creation of Connect spans. | diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts b/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts index 5fbe28c84de7..e462a677642f 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts @@ -20,5 +20,6 @@ dependencies { tasks.withType().configureEach { // TODO run tests both with and without experimental span attributes jvmArgs("-Dotel.instrumentation.lettuce.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.lettuce.connection-telemetry.enabled=true") usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java index 9a5195efe243..cdf509ab7988 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSingletons.java @@ -17,6 +17,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; public final class LettuceSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.lettuce-4.0"; @@ -49,6 +50,9 @@ public final class LettuceSingletons { PeerServiceAttributesExtractor.create( netAttributesGetter, CommonConfig.get().getPeerServiceResolver())) .addAttributesExtractor(new LettuceConnectAttributesExtractor()) + .setEnabled( + InstrumentationConfig.get() + .getBoolean("otel.instrumentation.lettuce.connection-telemetry.enabled", false)) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts b/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts index a3c49e15b398..0ebb0fa515ac 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts @@ -25,5 +25,6 @@ dependencies { tasks.withType().configureEach { // TODO run tests both with and without experimental span attributes jvmArgs("-Dotel.instrumentation.lettuce.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.lettuce.connection-telemetry.enabled=true") usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java index c27532ef844e..0cc13a7ce472 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceSingletons.java @@ -17,6 +17,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesExtractor; import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; +import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; public final class LettuceSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.lettuce-5.0"; @@ -50,6 +51,9 @@ public final class LettuceSingletons { PeerServiceAttributesExtractor.create( connectNetworkAttributesGetter, CommonConfig.get().getPeerServiceResolver())) .addAttributesExtractor(new LettuceConnectAttributesExtractor()) + .setEnabled( + InstrumentationConfig.get() + .getBoolean("otel.instrumentation.lettuce.connection-telemetry.enabled", false)) .buildInstrumenter(SpanKindExtractor.alwaysClient()); }