Closed holyjak closed 3 years ago
Hi Jakub, Thanks for your message!
As the OpenTracingStart
phase is inserted before the Features phase, I recommend that you intercept the Features phase.
You can add a code block to the phase in your module function as such:
intercept(ApplicationCallPipeline.Features) {
MDC.put("traceId", GlobalTracer.get().activeSpan().context().toTraceId())
}
Francois
Thanks a lot! I fixed that via
intercept(ApplicationCallPipeline.Features) {
println("Intercept before: spanContext=" + current().spanContext)
proceed()
println("Intercept after: spanContext=" + current().spanContext)
}
though I am not abandoning OpenTracing for OpenTelemetry. I will steal all the ideas from your code :-)
You're welcome! :)
Hello! Thanks a lot for this library!
I would like to use
MDC.put
to put the trace-id into the logging context so that it gets included in all logs. But when I should do that? I guess I would need to define my own phase and insert it between Features and OpenTracingStart. Or? Thank you!