Struct SpanContext
pub struct SpanContext { /* private fields */ }
opentelemetry
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§
§impl SpanContext
impl SpanContext
pub const NONE: SpanContext
pub const NONE: SpanContext
An invalid span context
pub fn empty_context() -> SpanContext
pub fn empty_context() -> SpanContext
Create an invalid empty span context
pub 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
pub 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
.
pub 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
.
pub fn is_remote(&self) -> bool
pub fn is_remote(&self) -> bool
Returns true
if the span context was propagated from a remote parent.
pub 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.
pub fn trace_state(&self) -> &TraceState
pub fn trace_state(&self) -> &TraceState
A reference to the span context’s TraceState
.
Trait Implementations§
§impl Clone for SpanContext
impl Clone for SpanContext
§fn clone(&self) -> SpanContext
fn clone(&self) -> SpanContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for SpanContext
impl Debug for SpanContext
§impl Hash for SpanContext
impl Hash for SpanContext
§impl PartialEq for SpanContext
impl PartialEq for SpanContext
impl Eq for SpanContext
impl StructuralPartialEq for SpanContext
Auto Trait Implementations§
impl Freeze for SpanContext
impl RefUnwindSafe for SpanContext
impl Send for SpanContext
impl Sync for SpanContext
impl Unpin for SpanContext
impl UnwindSafe for SpanContext
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.