pub struct HeaderExtractor<'a>(/* private fields */);
Expand description
Extracts the TextMapPropagator
to access trace parent information in
HTTP headers.
This propagation is useful when an HTTP request already has a trace parent
which can be picked up by the Tower Layer
to link both spans together.
A concrete usage example is available in SpanExt::from_request
.
This is pretty much a copy-pasted version of the HeaderExtractor
from
the opentelemetry_http
crate. However, we cannot use this crate, as it
uses an outdated version of the underlying http
crate.
Implementations§
Source§impl<'a> HeaderExtractor<'a>
impl<'a> HeaderExtractor<'a>
Sourcepub fn new(headers: &'a HeaderMap) -> Self
pub fn new(headers: &'a HeaderMap) -> Self
Create a new header extractor from a reference to a [HeaderMap
].
Sourcepub fn extract_context(&self) -> Context
pub fn extract_context(&self) -> Context
Extracts the TextMapPropagator
from the HTTP headers.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for HeaderExtractor<'a>
impl<'a> RefUnwindSafe for HeaderExtractor<'a>
impl<'a> Send for HeaderExtractor<'a>
impl<'a> Sync for HeaderExtractor<'a>
impl<'a> Unpin for HeaderExtractor<'a>
impl<'a> UnwindSafe for HeaderExtractor<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request