Span.currentSpan() returns a span whose Trace's id is 00000000000000000000000000000000 instead of the actual current trace's id #12217
-
Hi All, As provided a resolution here #2543
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 16 replies
-
A trace/span id of all zeros denotes an invalid trace, this is used when there is no active trace. Without knowing anything about your application it is hard to tell why this happens. It would be best if you could provide a minimal application that reproduces your issue along with any necessary instructions. You may also try with the agent and see if it works any better. |
Beta Was this translation helpful? Give feedback.
-
Hi @laurit Here is a sample project and I wanted to see a traceId and spanId in my logs when two of my microservices are communicating with restTemplate. I wanted to do manual instrumentation with opentelemetry because the opentelemetry java agent jar will support RestTemplate instrumentation but not the WebClinet and WebSocket communication between my microservices which I already have currently in my main project. Thanks |
Beta Was this translation helpful? Give feedback.
-
I got the resolution from @laurit and thanks for support. |
Beta Was this translation helpful? Give feedback.
You won't be able to get the trace id with
MDC.get("trace_id")
. Have a look at the instrumentation in https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-mdc-1.0/library You'll see that the trace id isn't really added to the MDC but to the copy of MDC that is attached to the logging event.I have no idea what you mean by that. If you mean that it is missing from stuff logged by
LoggingSpanExporter
then that is expected.Overall to me it seems that tr…