Module trace

Module trace 

Source
Expand description

Distributed trace context types for W3C traceparent propagation.

All types are no_std compatible. The TraceContext struct carries a 16-byte trace ID, 8-byte span ID, and 1-byte flags field conforming to the W3C Trace Context specification.

§Binary encoding

[version: 1B] [trace_id: 16B] [span_id: 8B] [flags: 1B] [reserved: 6B]

Total: 32 bytes (fits in a single cache line, suitable for shared-memory RPC header extension).

§W3C string format

00-{trace_id:032x}-{span_id:016x}-{flags:02x}

Structs§

SpanId
8-byte span identifier, unique per span within a trace.
TraceContext
W3C trace context in binary form.
TraceId
16-byte trace identifier, unique per trace.

Enums§

TraceContextError
Errors from trace context encoding/decoding.

Constants§

FLAG_SAMPLED
Flag bit: trace is sampled.
TRACE_CONTEXT_BYTES
Binary encoding size.