pub struct SpanHandle {
pub trace_id: [u8; 16],
pub span_id: [u8; 8],
}Expand description
An opaque handle returned by TracerPlugin::start_span. Passing a
SpanHandle back to the same tracer is how the runtime attaches
attributes, events, and status to an active span. Handles are cheap
Copy values — they are just the id pair the tracer already emits
on the wire.
A handle is only valid for the tracer that created it. Passing a handle produced by one tracer to another tracer is a programmer error; implementations should treat unknown handles as a no-op rather than panicking.
Fields§
§trace_id: [u8; 16]Trace id (W3C trace-context trace-id, 16 bytes big-endian).
span_id: [u8; 8]Span id (W3C trace-context parent-id / span-id, 8 bytes).
Implementations§
Source§impl SpanHandle
impl SpanHandle
Sourcepub const INVALID: SpanHandle
pub const INVALID: SpanHandle
Invalid / “not sampled” handle. Tracer implementations return this
from start_span when a sampling decision rejects the span; the
runtime treats it as a no-op but still threads it through as the
parent of any child spans so the shape of the caller’s code does
not change between sampled and non-sampled runs.
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Returns true if the handle is the invalid/no-op sentinel.
Trait Implementations§
Source§impl Clone for SpanHandle
impl Clone for SpanHandle
Source§fn clone(&self) -> SpanHandle
fn clone(&self) -> SpanHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more