-
Hi, Below are the config i have done for my application, trace and span id generated also traceparent added in kafka message header as - 00-9e94c3668945e351de9bcce36fa50b77-6cf5599c9aa1bb9e-01 pom.xml
log4j2.xml
2024-09-23T15:03:59.466+05:30 trace_id= span_id= trace_flags= INFO 57396 --- [otel_demo] [nio-8080-exec-1] o.a.k.c.t.i.KafkaMetricsCollector : initializing Kafka metrics collector Set environment variable : export OTEL_METRICS_EXPORTER=none Running application with - jar - java -Dotel.metrics.exporter=none -jar ./target/otel-demo-0.0.1-SNAPSHOT.jar I have also tried with logback from reference - https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-mdc-1.0/library still the same. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
To have trace and span id available in MDC you must have an active trace. For kafka this means that you need instrumentation that restores context from context propagation header added to a kafka message. Looking at your pom fragment you don't seem to be using a kafka instrumentation so not having trace and span id is expected. Even if you use kafka instrumentation trace and span id will only be available when the context is restored, for example when using https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-kafka-2.7 you could expect to observe the restored context while inside a |
Beta Was this translation helpful? Give feedback.
hi @sulthans, you can build a Java agent extension and write your own Exporter