Struct opentelemetry::trace::SpanContext
source · [−]pub struct SpanContext { /* private fields */ }
Expand description
Immutable portion of a Span
which can be serialized and propagated.
Spans that do not have the sampled
flag set in their TraceFlags
will
be ignored by most tracing tools.
Implementations
sourceimpl SpanContext
impl SpanContext
sourcepub fn empty_context() -> Self
pub fn empty_context() -> Self
Create an invalid empty span context
sourcepub fn new(
trace_id: TraceId,
span_id: SpanId,
trace_flags: TraceFlags,
is_remote: bool,
trace_state: TraceState
) -> Self
pub fn new(
trace_id: TraceId,
span_id: SpanId,
trace_flags: TraceFlags,
is_remote: bool,
trace_state: TraceState
) -> Self
Construct a new SpanContext
sourcepub fn trace_flags(&self) -> TraceFlags
pub fn trace_flags(&self) -> TraceFlags
Returns details about the trace. Unlike TraceState
values, these are
present in all traces. Currently, the only option is a boolean sampled flag.
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns a bool flag which is true if the SpanContext
has a valid (non-zero) trace_id
and a valid (non-zero) span_id
.
sourcepub fn is_remote(&self) -> bool
pub fn is_remote(&self) -> bool
Returns true if the SpanContext
was propagated from a remote parent.
sourcepub fn is_sampled(&self) -> bool
pub fn is_sampled(&self) -> bool
Returns true
if the sampled
trace flag is set.
Spans that are not sampled will be ignored by most tracing tools.
sourcepub fn trace_state(&self) -> &TraceState
pub fn trace_state(&self) -> &TraceState
Returns the context’s TraceState
.
Trait Implementations
sourceimpl Clone for SpanContext
impl Clone for SpanContext
sourcefn clone(&self) -> SpanContext
fn clone(&self) -> SpanContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for SpanContext
impl Debug for SpanContext
sourceimpl Hash for SpanContext
impl Hash for SpanContext
sourceimpl PartialEq<SpanContext> for SpanContext
impl PartialEq<SpanContext> for SpanContext
sourcefn eq(&self, other: &SpanContext) -> bool
fn eq(&self, other: &SpanContext) -> bool
impl Eq for SpanContext
impl StructuralEq for SpanContext
impl StructuralPartialEq for SpanContext
Auto Trait Implementations
impl RefUnwindSafe for SpanContext
impl Send for SpanContext
impl Sync for SpanContext
impl Unpin for SpanContext
impl UnwindSafe for SpanContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more