Struct opentelemetry::trace::SpanContext
source · [−]pub struct SpanContext { /* private fields */ }
trace
only.Expand description
Immutable portion of a Span
which can be serialized and propagated.
This representation conforms to the W3C TraceContext specification.
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() -> SpanContext
pub fn empty_context() -> SpanContext
Create an invalid empty span context
sourcepub fn new(
trace_id: TraceId,
span_id: SpanId,
trace_flags: TraceFlags,
is_remote: bool,
trace_state: TraceState
) -> SpanContext
pub fn new(
trace_id: TraceId,
span_id: SpanId,
trace_flags: TraceFlags,
is_remote: bool,
trace_state: TraceState
) -> SpanContext
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. The current
version of the specification only supports a single flag TraceFlags::SAMPLED
.
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true
if the span context 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 span context 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
A reference to the span 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 more
sourceimpl 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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
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
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.