#[non_exhaustive]pub struct TraceContext {
pub trace_id: TraceId,
pub parent_id: Option<SpanId>,
pub flags: u8,
pub tracestate: Option<HeaderValue>,
}Expand description
The trace a request belongs to.
Put in the request’s extensions by the host before the request reaches the REST pipeline or GraphQL, so anything downstream can find it without parsing the headers again.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.trace_id: TraceIdThe trace the request is part of.
parent_id: Option<SpanId>The caller’s span, when the request said which it was. None when the
trace started here.
flags: u8trace-flags as the caller sent them; bit 0 is “sampled”. Zero when
the trace started here.
tracestate: Option<HeaderValue>tracestate, carried as it came, for whatever propagates the trace on.
Only kept beside a traceparent that parsed: the specification has it
mean nothing on its own.
Implementations§
Source§impl TraceContext
impl TraceContext
Sourcepub fn from_headers(headers: &HeaderMap) -> Option<Self>
pub fn from_headers(headers: &HeaderMap) -> Option<Self>
The trace the request’s traceparent and tracestate name, or None
when there is no traceparent or it cannot be used.
More than one traceparent is refused rather than one of them picked:
the specification leaves no way to tell which is meant. Several
tracestate headers are one list split across lines, and are joined.
Trait Implementations§
Source§impl Clone for TraceContext
impl Clone for TraceContext
Source§impl Debug for TraceContext
impl Debug for TraceContext
impl Eq for TraceContext
Source§impl PartialEq for TraceContext
impl PartialEq for TraceContext
impl StructuralPartialEq for TraceContext
Auto Trait Implementations§
impl !Freeze for TraceContext
impl RefUnwindSafe for TraceContext
impl Send for TraceContext
impl Sync for TraceContext
impl Unpin for TraceContext
impl UnsafeUnpin for TraceContext
impl UnwindSafe for TraceContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more