Skip to content

Commit

Permalink
Disable lettuce CONNECT spans by default (#10215)
Browse files Browse the repository at this point in the history
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
  • Loading branch information
trask and laurit authored Jan 12, 2024
1 parent c418b14 commit f1ed419
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion instrumentation/lettuce/README.md
Original file line number Diff line number Diff line change
@@ -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. |
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit f1ed419

Please sign in to comment.