Sleuth and Java APM Agent using the same Trace/Span ids


This might be a vague question, so please bare with me. I am trying to integrate APM with our current distributed tracing stack involving Spring Cloud Sleuth. Essentially, I registered an OpenTracing tracer bean which uses the ElasticApmTracer instance; however, it seems as though Sleuth and the APM tracers are working independently and so I observe different trace/span ids for the same micro-service request.

My question is, is there any docs I could be pointed to that somewhat hint at how to accomplish should a task of incorporating say a current distributed tracing tool like Sleuth with APM so that they both are in synergy?


Hi and welcome to the forum :slight_smile:

This is probably due to the fact that Elastic APM and Sleuth use different headers to propagate the context. IIRC, Sleuth uses B3 headers, whereas Elastic APM uses elastic-apm-traceparent which is a variant of the W3C spec draft for the traceparent header.

See for more information.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.