-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In kafka events, the traceId and spanId are not written in the logs #4859
Comments
You might be in the wrong repo. :) Also, please consider these:
I'm not sure this is because of your custom async config or creating a scope is missing somewhere in the instrumentation. /cc @artembilan |
I did as you said: Why is the KafkaTemplateObservationConvention relevant? Can you repro the issue without it? We also used this link: https://github.com/micrometer-metrics/micrometer-samples/blob/main/kafka-producer/src/main/java/com/example/micrometer/ManualConfiguration.java |
The problem is related to the transition to spring boot 3. On Spring boot 2, the Sleuth library was used for tracing and kafka event tracing was present. But when we started using examples and instructions from micrometer, trace id did not appear, it only appeared in kafka headers |
The |
Describe
In kafka events, the traceId and spanId are not written in the logs
Environment
Java 17. Spring boot starter 3.2.2
We use the following dependencies for tracing:
Kafka Template Bean:
application.yml file
code:
What's going on
In this case, the kafka topic places traceId and span Id in headers, but the logging pattern does not find these traceId and spanId and accordingly does not write them in logs.
What have we changed
We added Map<String, String> copyOfContextMap = MDC.getCopyOfContextMap(); to producer. and information about traceId and spanId began to appear in the logs.
Is there a better solution for not writing this?: Map<String, String> copyOfContextMap = MDC.getCopyOfContextMap();
The text was updated successfully, but these errors were encountered: