What is a trace, what is a span, and what does the trace ID do?
A trace is the complete journey of one request from start to finish, a span is a single processing step within it, and the trace ID is the identifier carried through every system that lets all the spans be reassembled into one trace.
* One request's path: every hop carries the same trace ID, so its spans can be reassembled afterwards. *
* The same trace as a waterfall: nested spans, and a parent's time minus its children's is the time it spent itself. *
- Trace — the whole request. "User clicks checkout" produces one trace: web front end → API gateway → Service B → database, plus Service C → an external system.
- Span — one step inside that journey: the database query, the call to Service C, the work inside the gateway. Spans nest, so a parent span's duration contains its children's, and the difference between them is time the parent itself spent.
- Trace ID — the unique identifier assigned when the request arrives, passed along in every downstream call so each participating system tags its spans with it. Without propagation there is no trace, only unconnected fragments.
What that buys you: an end-to-end view of user requests, transparency about which services depend on which, the ability to locate bottlenecks by comparing span durations, and root-cause analysis in a distributed system where no single log file contains the whole story.
Tip: trace = the journey, span = one leg of it, trace ID = the boarding-pass number that connects the legs.
Go deeper:
OpenTelemetry: Traces — spans, attributes, context propagation and how a trace is assembled.
W3C Trace Context — the standard HTTP headers (
traceparent) that carry the trace ID from one service to the next.Jaeger — an open-source tracing back end whose UI shows traces as waterfall diagrams of spans.