When producing a message, extract the current span context and serialize it into the message headers or attributes using the W3C TraceContext propagator
When consuming the message, extract the producer's span context from the headers using propagator.extract()
Create the consumer span as a new root (do not use the producer context as parent) to keep producer and consumer traces independent and correctly timed
Add a SpanLink from the consumer span to the producer span context: span.addLink({context: producerSpanContext}) with an optional attributes map
In the trace backend (Jaeger, Tempo), use the span link to navigate between the producer and consumer traces for end-to-end request correlation
Known gotchas
Using the producer span as the parent rather than a link causes the consumer span to extend the producer trace duration, producing misleading latency numbers
Span links are a relatively new OTel concept; not all trace backends render or query them; confirm backend support before relying on links for on-call workflows
Message headers have size limits; serialized span context (trace parent + tracestate + baggage) can exceed these limits when baggage entries accumulate
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp