Function inject_context

Source
pub fn inject_context(headers: &mut HeaderMap)
Expand description

Injects the current OpenTelemetry context into HTTP headers.

This convenience function automatically finds the current OpenTelemetry context and injects its trace information into the provided HTTP headers using the globally configured text map propagator.

§Arguments

  • headers: Mutable reference to HTTP headers where context will be injected

§Examples

use http::HeaderMap;
use telemetry_rust::http::inject_context;

let mut headers = HeaderMap::new();
inject_context(&mut headers);