pub struct TraceContext {
pub trace_id: [u8; 16],
pub span_id: [u8; 8],
pub parent_span_id: [u8; 8],
}Expand description
Distributed-tracing identity for one server hop.
Fields§
§trace_id: [u8; 16]Preserved across the entire distributed call chain.
span_id: [u8; 8]This hop’s freshly-minted span ID.
parent_span_id: [u8; 8]The upstream caller’s span ID (all-zeros = this hop is the root).
Implementations§
Source§impl TraceContext
impl TraceContext
Sourcepub fn to_traceparent(&self) -> String
pub fn to_traceparent(&self) -> String
W3C traceparent string for embedding in non-HTTP envelopes
(outbox rows, queue messages) — 00-{trace}-{span}-01 where the
span field is THIS hop’s span (the consumer’s parent).
Sourcepub fn from_traceparent(s: &str) -> Option<TraceContext>
pub fn from_traceparent(s: &str) -> Option<TraceContext>
Continue a trace carried in a message envelope: same trace ID, the producer’s span becomes this hop’s parent, and a fresh span is minted for the consumer side — so async hops chain in the trace UI instead of starting orphan roots.
Sourcepub fn new_root() -> TraceContext
pub fn new_root() -> TraceContext
A brand-new root trace (for messages with no carried context).
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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