W3C Trace Context
The W3C Trace Context specification defines a means of propagating context information about a specific HTTP transaction through a distributed system for the purposes of observability.
It is intended to replace vendor-specific implementations, which:
- May not be correlated between vendors due to the lack of agreed identifiers.
- May be dropped by intermediaries which don't support them.
- Service providers can't guarantee support as there's no uniform standard.
Concepts
- Two propagation fields, implemented as HTTP headers:
traceparent
describes the position of a transaction in a trace graph. It has four hex-encoded, dash (-
) delimited components:version
specifies the W3C Trace Context specification version.trace-id
uniquely identifies a distributed trace.parent-id
identifies the parent span.trace-flags
:sampled
indicates a caller may have recorded trace data.
tracestate
optionally extendstraceparent
with key-value pairs. Vendor-specific/proprietary implementation detail is supported as a series of opaque values. These are expressed as a comma-delimited list of key-value pairs, e.g.field=value,otherField=otherValue
. Keys may encode a tenant ID at the beginning of each key (some-tenant@field=value
). Each key can appear only once, and should be rewritten.
- Tools can have two levels of support:
- At a minimum, propagation of the
Traceparent
andTracestate
headers. - Participation, where they modify the headers.
- At a minimum, propagation of the
Backlinks