pub struct TraceContext {
pub trace_id: String,
pub span_id: String,
pub trace_flags: u8,
pub trace_state: String,
}Expand description
A parsed traceparent (plus the unparsed tracestate).
Producers set the headers at enqueue; the runtime parses traceparent at DISPATCH
and hands the result to the handler and to the telemetry facade. See
parse_traceparent for what “lenient” means here.
Fields§
§trace_id: String32 lowercase hex characters, never all zero.
span_id: String16 lowercase hex characters, never all zero. The PARENT span id: a job span created from this context is a child of it.
trace_flags: u8The 8 trace-flags bits. Bit 0 is sampled.
trace_state: StringVerbatim tracestate, empty when absent. Never parsed.
Implementations§
Source§impl TraceContext
impl TraceContext
Sourcepub fn to_traceparent(&self) -> String
pub fn to_traceparent(&self) -> String
Re-render the traceparent header value. Round-trips parse_traceparent
exactly, so a runtime that re-injects the context into a downstream call emits
the same bytes the producer sent.
Trait Implementations§
Source§impl Clone for TraceContext
impl Clone for TraceContext
Source§fn clone(&self) -> TraceContext
fn clone(&self) -> TraceContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TraceContext
impl Debug for TraceContext
Source§impl Default for TraceContext
impl Default for TraceContext
Source§fn default() -> TraceContext
fn default() -> TraceContext
Returns the “default value” for a type. Read more
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
Mutably borrows from an owned value. Read more