Trait TextMapPropagator
pub trait TextMapPropagator: Debug {
// Required methods
fn inject_context(&self, cx: &Context, injector: &mut dyn Injector);
fn extract_with_context(
&self,
cx: &Context,
extractor: &dyn Extractor,
) -> Context;
fn fields(&self) -> FieldIter<'_> ⓘ;
// Provided methods
fn inject(&self, injector: &mut dyn Injector) { ... }
fn extract(&self, extractor: &dyn Extractor) -> Context { ... }
}
Available on crate feature
opentelemetry
only.Expand description
Methods to inject and extract a value as text into injectors and extractors that travel in-band across process boundaries.
Required Methods§
fn inject_context(&self, cx: &Context, injector: &mut dyn Injector)
fn inject_context(&self, cx: &Context, injector: &mut dyn Injector)
fn extract_with_context(
&self,
cx: &Context,
extractor: &dyn Extractor,
) -> Context
fn extract_with_context( &self, cx: &Context, extractor: &dyn Extractor, ) -> Context
fn fields(&self) -> FieldIter<'_> ⓘ
fn fields(&self) -> FieldIter<'_> ⓘ
Returns iter of fields used by TextMapPropagator
Provided Methods§
Implementations on Foreign Types§
§impl TextMapPropagator for BaggagePropagator
impl TextMapPropagator for BaggagePropagator
§fn inject_context(&self, cx: &Context, injector: &mut dyn Injector)
fn inject_context(&self, cx: &Context, injector: &mut dyn Injector)
Encodes the values of the Context
and injects them into the provided Injector
.
§fn extract_with_context(
&self,
cx: &Context,
extractor: &dyn Extractor,
) -> Context
fn extract_with_context( &self, cx: &Context, extractor: &dyn Extractor, ) -> Context
Extracts a Context
with baggage values from a Extractor
.
fn fields(&self) -> FieldIter<'_> ⓘ
§impl TextMapPropagator for TraceContextPropagator
impl TextMapPropagator for TraceContextPropagator
§fn inject_context(&self, cx: &Context, injector: &mut dyn Injector)
fn inject_context(&self, cx: &Context, injector: &mut dyn Injector)
Properly encodes the values of the SpanContext
and injects them
into the Injector
.
§fn extract_with_context(
&self,
cx: &Context,
extractor: &dyn Extractor,
) -> Context
fn extract_with_context( &self, cx: &Context, extractor: &dyn Extractor, ) -> Context
Retrieves encoded SpanContext
s using the Extractor
. It decodes
the SpanContext
and returns it. If no SpanContext
was retrieved
OR if the retrieved SpanContext is invalid then an empty SpanContext
is returned.