Span Links: Connecting Async Flows
When a request triggers async work, span links connect the flows. The pattern, the tooling, and the visualisations.
When you need it
Producer-consumer queues. The producer's request is one trace; the consumer's processing is another. Without a link, you cannot follow the flow.
Batch jobs that process events from many requests. The job's trace links to all the requests.
How
OTel's Span#addLink() API. Pass the trace ID and span ID of the originating work.
Most queue libraries auto-instrument. Verify; some do not.
Visualisation
Vendor support varies. Honeycomb, Datadog, Tempo all show span links to varying degrees.
Test before relying. Some vendors store the link but do not visualise it.