ObservabilitytraceparentW3C Trace Contextcontext propagationbaggage

Trace context

Definition

Trace context is the propagated identity of a trace; the W3C Trace Context standard carries it in the traceparent header (version, 32-hex trace id, 16-hex parent span id, flags) and optional tracestate.

In practice

Each service extracts the context from incoming requests, starts its own span as a child of the caller's span, and injects the updated context into outgoing calls. OpenTelemetry SDKs and most frameworks do this automatically for HTTP and gRPC. The flags carry the sampling decision, so downstream services keep or drop their spans consistently.

Propagation through queues and background jobs must be done explicitly by writing the context into message headers, or the trace stops at the producer. For long-lived consumers that batch many messages, span links are clearer than a single parent. Baggage carries application key-values along with the context, but it is sent on every hop, so keep it small and never put secrets in it.

Example

traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01 tells the callee the trace id, that its parent span is 00f067aa0ba902b7, and that the trace is sampled.