Skip to main content

Module trace

Module trace 

Source
Expand description

W3C Trace Context (traceparent) generation + parsing for the proxy.

The proxy generates a traceparent per request, or continues an inbound one (reusing its trace-id, minting a fresh span-id for the proxy span). The resulting header is echoed on the response and passed to the Bun worker as req.ctx.trace so a render log line can correlate with the proxy’s. Adapter child spans + OTLP export are post-MVP (see architecture §“Observability”).

Format (version 00): 00-<32 hex trace-id>-<16 hex parent-id>-<2 hex flags>.

IDs are minted from a SplitMix64 stream seeded by wall-clock nanos X’d with a process-global counter — unique enough for trace correlation without pulling in a CSPRNG (trace-ids are identifiers, not secrets).

Structs§

TraceParent