Expand description
W3C Trace Context propagation shared by Krabka’s wire-protocol crates.
This crate is the single place where a trace context crosses a Krabka process boundary. It covers the three shapes those boundaries take:
- Kafka record headers:
current_trace_headersinjects thetraceparentandtracestatepair that travels with a record.extract_contextandset_remote_parentrebuild that pair. - Structured RPC payloads:
TraceCarrieris a serde-serialisable field inside an existing request envelope, so a node-to-node call needs no extra frame. - SQL text:
extract_sqlcommenterreads the sqlcommenter/*traceparent='…'*/comment that OpenTelemetry-instrumented database drivers already append.
This crate deliberately depends on nothing but opentelemetry, tracing,
tracing-opentelemetry, and serde. The OTLP exporter, its configuration,
and the process-wide subscriber live in krabka-telemetry. That crate is
unpublished, and it pulls in a web server, a CLI parser, and a profiler.
None of those belong in a crate that a protocol codec links against.
krabka-telemetry re-exports this crate as
krabka_telemetry::propagation.
This crate validates ingress from an untrusted client. See
TraceCarrier::from_w3c for the exact rules, and for the reason it never
keeps the raw client string.
Structs§
- SqlCommenter
Trace - A trace context read out of a sqlcommenter tag, borrowed from the statement.
- Trace
Carrier - A W3C trace context in transit, sized to fit in a request payload.
Enums§
- Trace
Context Error - Why Krabka rejected a client-supplied W3C trace context.
Constants§
- TRACEPARENT
- The canonical W3C trace-context header keys.
- TRACESTATE
Functions§
- current_
trace_ headers - The W3C trace-context headers for the current
tracingspan. - extract_
context - Rebuild an OpenTelemetry
Contextfrom Kafka record headers. - extract_
sqlcommenter - Extract a sqlcommenter trace context from
sql, if it carries one. - set_
remote_ parent - Make
spana child of the trace thatheaderscarries.