Why a Standard
Before standardization, each tracing vendor used its own headers. A request crossing from one tool to another lost its context. W3C Trace Context defines a common format so any compliant system can read it.
The traceparent Header
The core is the traceparent header with four fields separated by dashes:
- version, currently 00.
- trace id, a 16 byte value shared across the request.
- parent id, the 8 byte id of the calling span.
- trace flags, including the sampled bit.
A second header, tracestate, carries vendor specific key value data so individual tools can add their own context without breaking the standard fields.
Crossing Boundaries
Each hop reads the trace id, keeps it, and replaces the parent id with its own span id before forwarding. The trace id never changes, which is what stitches the whole request together even across vendors.
Key idea
W3C Trace Context defines the traceparent and tracestate headers so trace id, parent id, and flags pass between tools from different vendors.