Function extract_context

Source
pub fn extract_context(metadata: &MetadataMap) -> Context
Expand description

Extracts the OpenTelemetry context from tonic metadata.

This extracts both W3C TraceContext and W3C Baggage headers from the metadata, returning a context that can be used as a parent for new spans or to read baggage values.

§Arguments

  • metadata - The tonic metadata map to extract from

§Returns

The extracted OpenTelemetry context, or an empty context if no propagation headers were found.