Traceresponse
The HTTP Traceresponse response header returns the server's trace context back to the client, using the same format as Traceparent.
Usage
Distributed tracing systems assign a trace ID to each request as the request enters the system. The Traceparent request header carries this context forward through backend services, but the client has no way to know the span ID the server assigned on its side. The Traceresponse header closes this gap by sending the server's trace context back in the response.
The value follows the same four-field format as
Traceparent: version-trace_id-parent_id-trace_flags.
The trace_id matches the one from the original request,
and the parent_id contains the span ID generated by the
responding server. This allows the client to stitch its
own trace span to the server's entry-point span, creating
an unbroken trace across the client-server boundary.
The header is defined in the W3C Trace Response Headers editorial draft, a separate effort from the W3C Trace Context specification (covering Traceparent and Tracestate). As an editorial draft rather than a formal recommendation, real-world adoption remains limited. Most distributed tracing systems rely on Traceparent and Tracestate without sending a response-side trace header.
Values
version
A two-character hex value representing the trace context
version. The current version is 00.
trace_id
A 32-character hex string identifying the entire
distributed trace. This value matches the trace_id
sent in the Traceparent request header.
parent_id
A 16-character hex string representing the span ID assigned by the server for the operation. The client uses this span ID to link its own span as the parent of the server's work.
trace_flags
A two-character hex value encoding trace flags. 01
means the trace is sampled (recorded), and 00 means
the trace is not sampled.
Example
A standard Traceresponse value echoing back the server's
trace context. The trace_id field
(187de842ffb5ffb4cce00cf934f3b80e) matches the one
from the corresponding Traceparent request header. The
parent_id (8f07a3da36d28ed3) identifies the span the
server created for this request. The trailing 01
indicates the trace was sampled.
Traceresponse: 00-187de842ffb5ffb4cce00cf934f3b80e-8f07a3da36d28ed3-01
A different server returning an unsampled trace. The
trace_flags value of 00 means no tracing data was
recorded on the server side, even though the trace
context was propagated.
Traceresponse: 00-f9626e018c145c2614af51cad53785fa-160d1e69a26bf0fe-00
A Traceparent and Traceresponse pair showing the full
round trip. The client sends a Traceparent header with
its own span ID, and the server responds with a
Traceresponse containing the server-side span ID. Both
share the same trace_id, linking the two sides of the
request.
Traceparent: 00-189706933aa7090e67cf68016efaf2b7-abc123def4567890-01
Traceresponse: 00-189706933aa7090e67cf68016efaf2b7-9fa00624883afaf2-01
Takeaway
The Traceresponse header returns the server's trace context to the client, enabling end-to-end correlation between client-side and server-side spans in distributed tracing systems.
See also
- W3C Trace Response Headers (Editorial Draft)
- W3C Trace Context Level 2
- Traceparent
- Tracestate
- HTTP headers