pub struct RequestTrace { /* private fields */ }Expand description
The host-owned trace context for one request transaction. Created by the chain driver (the
ConfigSnapshot / fast-path server), it parents every filter span so the whole
chain — request side and response side — shares one trace. Cheap to copy.
request_span_id is ALWAYS locally minted — it names the request (SERVER) span Plecto itself
owns. An inbound traceparent’s span id is kept separately as parent_span_id (the remote
parent), never reused as our own: emitting a span under an id another process minted would
collide with that process’s exporter (ADR 000040). This is the standard proxy shape — the
upstream and every filter span nest under Plecto’s request span.
Implementations§
Source§impl RequestTrace
impl RequestTrace
Sourcepub fn root() -> RequestTrace
pub fn root() -> RequestTrace
Start a fresh, sampled root trace for a request with no inbound context.
Sourcepub fn from_traceparent(traceparent: &str) -> Option<RequestTrace>
pub fn from_traceparent(traceparent: &str) -> Option<RequestTrace>
Continue an inbound trace from a W3C traceparent (00-{trace}-{span}-{flags}). The
inbound span becomes this request’s REMOTE PARENT; the request span id itself is minted
locally. Returns None on any malformed field (fail-soft: a bad header just starts no
continuation, never a panic on untrusted input).
Sourcepub fn to_traceparent(&self) -> String
pub fn to_traceparent(&self) -> String
Format as a W3C traceparent for downstream propagation. Carries the (locally-minted)
request span id, so the upstream’s spans nest under Plecto’s request span.
pub fn trace_id(&self) -> TraceId
Sourcepub fn request_span_id(&self) -> SpanId
pub fn request_span_id(&self) -> SpanId
The request (root) span id — the parent of every filter span in this transaction.
Sourcepub fn parent_span_id(&self) -> Option<SpanId>
pub fn parent_span_id(&self) -> Option<SpanId>
The inbound (remote) span this transaction continues under, or None for a local root.
pub fn is_sampled(&self) -> bool
Trait Implementations§
Source§impl Clone for RequestTrace
impl Clone for RequestTrace
Source§fn clone(&self) -> RequestTrace
fn clone(&self) -> RequestTrace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RequestTrace
Auto Trait Implementations§
impl Freeze for RequestTrace
impl RefUnwindSafe for RequestTrace
impl Send for RequestTrace
impl Sync for RequestTrace
impl Unpin for RequestTrace
impl UnsafeUnpin for RequestTrace
impl UnwindSafe for RequestTrace
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<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> 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