Function inject_context

Source
pub fn inject_context(cx: &Context, metadata: &mut MetadataMap)
Expand description

Injects the OpenTelemetry context into tonic metadata.

This injects both W3C TraceContext (traceparent, tracestate) and W3C Baggage (baggage) headers into the metadata, enabling distributed tracing and baggage propagation across gRPC service boundaries.

ยงArguments

  • cx - The OpenTelemetry context to inject
  • metadata - The tonic metadata map to inject into