Skip to main content

Module Traceparent

Module Traceparent 

Source
Expand description

W3C traceparent header builder + parser. Used by every emit / RPC site that crosses a tier boundary (Mountain → Sky tauri events, Mountain → Cocoon gRPC, Sky → Mountain TauriInvoke, Cocoon → Mountain gRPC). The format is the standard version-traceid-parentid-flags from https://www.w3.org/TR/trace-context/.

Mountain (and every sidecar that imports CommonLibrary::Telemetry) reuses one OTLP_TRACE_ID per process via EmitOTLPSpan::TraceId, so the trace_id field of the header stays stable for the lifetime of the process. Each emit mints a fresh span_id so the receiver can attach a child span keyed on this exact crossing.

Structs§

Decoded
Decoded crossing-id pair. The receiver opens a child span linked to (TraceId, ParentSpanId).

Constants§

SAMPLED_FLAG 🔒
VERSION 🔒
W3C version 00, sampled flag set (01).

Functions§

Build
Build a W3C traceparent header value for an outgoing crossing. Same trace ID across the whole process; fresh span ID per call.
FreshSpanId 🔒
Parse
Parse a traceparent header value. Returns None if the input doesn’t match the W3C version-00 layout.
TraceIdValue
Bridge to EmitOTLPSpan::TraceId. Public so callers wanting to stamp $trace_id on a PostHog event without going through the span pipeline can read the same value the OTLP exporter uses.