Skip to main content

Module otel

Module otel 

Source
Expand description

OpenTelemetry trace context helpers for HTTP headers

Provides W3C Trace Context propagation with optional OpenTelemetry integration.

  • With otel feature: Uses proper OTEL propagators for distributed tracing
  • Without otel feature: No-op implementations (graceful degradation)

Constants§

TRACEPARENT
W3C Trace Context header name

Functions§

get_traceparent
Extract traceparent header value from HTTP headers
inject_current_span
Inject current OpenTelemetry context into HTTP headers. Uses the global propagator to inject W3C Trace Context.
parse_trace_id
Parse trace ID from W3C traceparent header (format: “00-{trace_id}-{span_id}-{flags}”)
set_parent_from_headers
Set span parent from W3C Trace Context headers. Extracts the trace context and sets it as the parent of the given span.