Thirty percent of the root spans in your backend services have no parent, although the edge gateway starts a trace for every request. How do you find where context is lost across 200 services, and how do you stop it coming back?
Sketch your own answer first, then compare it with the one below.
A strong answer
A server span that should have a parent but is a root means the incoming request carried no usable trace context. So the question for each service is how often its inbound spans are roots. Graph that ratio per service and per caller. A healthy service sits near zero. A service whose callers are all healthy but whose own inbound ratio is high has a problem upstream of it, in the service that calls it. Walking the call graph from the edge, the first edge where the ratio jumps shows the hop that drops context.
Typical culprits are a client library that does not inject the header, a thread pool or async hop where the context is not carried over, a queue or proxy that strips headers, and a mix of propagation formats, such as an older vendor header on one side and W3C traceparent on the other. A service mesh sidecar cannot repair the middle of an application: it can start spans for traffic it sees, but the app has to pass the context from the inbound call to the outbound one.
To stop it recurring, put propagation in the shared HTTP, gRPC and messaging clients so teams do not write it, standardise on W3C Trace Context with any legacy format as a secondary propagator, and add a contract test that a call through each client carries the header. Keep the orphan-ratio graph as an alert, so a regression is found within a day.
Sources
- Sergey Kanzhelev, Morgan McLean, Alois Reitbauer, Bogdan Drutu, Nik Molnar, Yuri Shkuro (2021). Trace Context.
- Benjamin H. Sigelman, Luiz André Barroso, Mike Burrows, Pat Stephenson, Manoj Plakal, Donald Beaver, Saul Jaspan, Chandan Shanbhag (2010). Dapper, a Large-Scale Distributed Systems Tracing Infrastructure.