Disable the messaging receive span telemetry by default (#5500)
* Disable the messaging receive span telemetry by default * fix spring-kafka tests * remove no longer needed link from the kafka-clients library instrumentation Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
parent
f318e08ead
commit
4ef6d165a9
|
@ -53,8 +53,8 @@ These configuration options are supported by all HTTP client and server instrume
|
|||
## Capturing servlet request parameters
|
||||
|
||||
You can configure the agent to capture predefined HTTP request parameter as span attributes for
|
||||
requests that are handled by Servlet API.
|
||||
Use the following property to define which servlet request parameters you want to capture:
|
||||
requests that are handled by Servlet API. Use the following property to define which servlet request
|
||||
parameters you want to capture:
|
||||
|
||||
| System property | Environment variable | Description |
|
||||
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------- |
|
||||
|
@ -62,3 +62,18 @@ Use the following property to define which servlet request parameters you want t
|
|||
|
||||
> **Note**: The property/environment variable names listed in the table are still experimental,
|
||||
> and thus are subject to change.
|
||||
|
||||
## Capturing consumer message receive telemetry in messaging instrumentations
|
||||
|
||||
You can configure the agent to capture the consumer message receive telemetry in messaging
|
||||
instrumentation. Use the following property to enable it:
|
||||
|
||||
| System property | Environment variable | Description |
|
||||
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------- |
|
||||
| `otel.instrumentation.messaging.experimental.receive-telemetry.enabled` | `OTEL_INSTRUMENTATION_MESSAGING_EXPERIMENTAL_RECEIVE_TELEMETRY_ENABLED` | Enables the consumer message receive telemetry. The default value is `false`.
|
||||
|
||||
Note that this will cause the consumer side to start a new trace, with only a span link connecting
|
||||
it to the producer trace.
|
||||
|
||||
> **Note**: The property/environment variable names listed in the table are still experimental,
|
||||
> and thus are subject to change.
|
||||
|
|
|
@ -32,8 +32,13 @@ public final class ExperimentalConfig {
|
|||
return config.getBoolean("otel.instrumentation.common.experimental.suppress-view-spans", false);
|
||||
}
|
||||
|
||||
public boolean suppressMessagingReceiveSpans() {
|
||||
public boolean messagingReceiveInstrumentationEnabled() {
|
||||
// TODO: remove that `suppress...` flag after 1.13 release
|
||||
boolean receiveSpansSuppressed =
|
||||
config.getBoolean(
|
||||
"otel.instrumentation.common.experimental.suppress-messaging-receive-spans", true);
|
||||
return config.getBoolean(
|
||||
"otel.instrumentation.common.experimental.suppress-messaging-receive-spans", false);
|
||||
"otel.instrumentation.messaging.experimental.receive-telemetry.enabled",
|
||||
!receiveSpansSuppressed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ tasks {
|
|||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
include("**/SpringListenerJms1SuppressReceiveSpansTest.*")
|
||||
jvmArgs("-Dotel.instrumentation.common.experimental.suppress-messaging-receive-spans=true")
|
||||
}
|
||||
|
||||
val jms2Test by existing(Test::class) {
|
||||
|
@ -39,13 +38,13 @@ tasks {
|
|||
// running a single test in the default test set will fail
|
||||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
|
||||
}
|
||||
|
||||
val jms2TestReceiveSpansDisabled by existing(Test::class) {
|
||||
filter {
|
||||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
jvmArgs("-Dotel.instrumentation.common.experimental.suppress-messaging-receive-spans=true")
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -57,6 +56,7 @@ tasks {
|
|||
excludeTestsMatching("SpringListenerJms1SuppressReceiveSpansTest")
|
||||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public final class JmsSingletons {
|
|||
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, spanNameExtractor)
|
||||
.addAttributesExtractor(attributesExtractor)
|
||||
.setTimeExtractor(new JmsMessageTimeExtractor())
|
||||
.setDisabled(ExperimentalConfig.get().suppressMessagingReceiveSpans())
|
||||
.setDisabled(!ExperimentalConfig.get().messagingReceiveInstrumentationEnabled())
|
||||
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ tasks {
|
|||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
include("**/KafkaClientSuppressReceiveSpansTest.*")
|
||||
jvmArgs("-Dotel.instrumentation.common.experimental.suppress-messaging-receive-spans=true")
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -58,5 +57,6 @@ tasks {
|
|||
excludeTestsMatching("KafkaClientSuppressReceiveSpansTest")
|
||||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,22 +60,10 @@ class KafkaClientPropagationDisabledTest extends KafkaClientPropagationBaseTest
|
|||
}
|
||||
}
|
||||
}
|
||||
trace(1, 3) {
|
||||
trace(1, 2) {
|
||||
span(0) {
|
||||
name SHARED_TOPIC + " receive"
|
||||
kind CONSUMER
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"$SemanticAttributes.MESSAGING_SYSTEM" "kafka"
|
||||
"$SemanticAttributes.MESSAGING_DESTINATION" SHARED_TOPIC
|
||||
"$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic"
|
||||
"$SemanticAttributes.MESSAGING_OPERATION" "receive"
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
name SHARED_TOPIC + " process"
|
||||
kind CONSUMER
|
||||
childOf span(0)
|
||||
hasNoLinks()
|
||||
attributes {
|
||||
"$SemanticAttributes.MESSAGING_SYSTEM" "kafka"
|
||||
|
@ -87,9 +75,9 @@ class KafkaClientPropagationDisabledTest extends KafkaClientPropagationBaseTest
|
|||
"kafka.offset" Long
|
||||
"kafka.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
span(2) {
|
||||
span(1) {
|
||||
name "processing"
|
||||
childOf span(1)
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,6 @@ class InterceptorsTest extends KafkaClientBaseTest implements LibraryTestTrait {
|
|||
name SHARED_TOPIC + " receive"
|
||||
kind CONSUMER
|
||||
childOf span(1)
|
||||
hasLink(span(1))
|
||||
attributes {
|
||||
"$SemanticAttributes.MESSAGING_SYSTEM" "kafka"
|
||||
"$SemanticAttributes.MESSAGING_DESTINATION" SHARED_TOPIC
|
||||
|
|
|
@ -68,7 +68,6 @@ class WrappersTest extends KafkaClientBaseTest implements LibraryTestTrait {
|
|||
name SHARED_TOPIC + " receive"
|
||||
kind CONSUMER
|
||||
childOf span(1)
|
||||
hasLink(span(1))
|
||||
attributes {
|
||||
"$SemanticAttributes.MESSAGING_SYSTEM" "kafka"
|
||||
"$SemanticAttributes.MESSAGING_DESTINATION" SHARED_TOPIC
|
||||
|
|
|
@ -67,7 +67,7 @@ public final class KafkaInstrumenterFactory {
|
|||
.addAttributesExtractor(attributesExtractor)
|
||||
.addAttributesExtractors(extractors)
|
||||
.setTimeExtractor(new KafkaConsumerTimeExtractor())
|
||||
.setDisabled(ExperimentalConfig.get().suppressMessagingReceiveSpans())
|
||||
.setDisabled(!ExperimentalConfig.get().messagingReceiveInstrumentationEnabled())
|
||||
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
|
||||
}
|
||||
|
||||
|
@ -102,13 +102,13 @@ public final class KafkaInstrumenterFactory {
|
|||
|
||||
if (!KafkaPropagation.isPropagationEnabled()) {
|
||||
return builder.newInstrumenter(SpanKindExtractor.alwaysConsumer());
|
||||
} else if (ExperimentalConfig.get().suppressMessagingReceiveSpans()) {
|
||||
return builder.newConsumerInstrumenter(KafkaConsumerRecordGetter.INSTANCE);
|
||||
} else {
|
||||
} else if (ExperimentalConfig.get().messagingReceiveInstrumentationEnabled()) {
|
||||
builder.addSpanLinksExtractor(
|
||||
SpanLinksExtractor.fromUpstreamRequest(
|
||||
GlobalOpenTelemetry.getPropagators(), KafkaConsumerRecordGetter.INSTANCE));
|
||||
return builder.newInstrumenter(SpanKindExtractor.alwaysConsumer());
|
||||
} else {
|
||||
return builder.newConsumerInstrumenter(KafkaConsumerRecordGetter.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ tasks {
|
|||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
include("**/KafkaStreamsSuppressReceiveSpansTest.*")
|
||||
jvmArgs("-Dotel.instrumentation.common.experimental.suppress-messaging-receive-spans=true")
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -46,5 +45,6 @@ tasks {
|
|||
excludeTestsMatching("KafkaStreamsSuppressReceiveSpansTest")
|
||||
isFailOnNoMatchingTests = false
|
||||
}
|
||||
jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,5 +34,6 @@ tasks {
|
|||
|
||||
// TODO run tests both with and without experimental span attributes
|
||||
jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true")
|
||||
jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue