Disable lettuce CONNECT spans by default (#10215)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
This commit is contained in:
Trask Stalnaker 2024-01-12 09:19:15 -08:00 committed by GitHub
parent c418b14914
commit f1ed419a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 1 deletions

View File

@ -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. |

View File

@ -20,5 +20,6 @@ dependencies {
tasks.withType<Test>().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)
}

View File

@ -17,6 +17,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
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());
}

View File

@ -25,5 +25,6 @@ dependencies {
tasks.withType<Test>().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)
}

View File

@ -17,6 +17,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
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());
}