Expand description
Zero-allocation trace propagation, span-ID generation, and atomic RED counters.
§W3C Trace Context
parse_traceparent extracts an incoming traceparent header into a
TraceCtx (trace ID + parent span ID). new_span_id / new_trace_id
generate fresh identifiers for root spans and per-hop server spans.
§Counters
Two relaxed atomics track total and in-flight requests. The RequestGuard
RAII type decrements in-flight on drop so the count stays accurate even when
a handler panics.
Structs§
- Request
Guard - RAII guard: increments in-flight on construction, decrements on drop.
- Trace
Ctx
Functions§
- hex_
encode - Encode arbitrary bytes as a lowercase hex string.
- new_
span_ id - Generate a fresh 64-bit span ID using monotonic time + sequential counter.
- new_
trace_ id - Generate a fresh 128-bit trace ID (two independent 64-bit halves).
- on_
request_ start - parse_
traceparent - Parse a W3C
traceparentheader without heap allocation. Format:00-<32 hex trace>-<16 hex span>-<2 hex flags>(55 bytes minimum). - snapshot
(total_requests, in_flight)– relaxed read, suitable for metrics endpoints.