pub struct Context {
pub trace_id: TraceId,
pub span_id: SpanId,
pub sampling_decision: SamplingDecision,
}
Expand description
A context for tracing the execution of processes, distributed or otherwise.
Consists of a span identifying an event, an optional parent span identifying a causal event that triggered the current span, and a trace with which all related spans are associated.
Fields§
§trace_id: TraceId
An identifier of the trace associated with the current context. A trace ID is typically created at a root span and passed along through all causal events.
span_id: SpanId
An identifier of the current span. In typical RPC usage, a span is created by a client before making an RPC, and the span ID is sent to the server. The server is free to create its own spans, for which it sets the client’s span as the parent span.
sampling_decision: SamplingDecision
Indicates whether a sampler has already decided whether or not to sample the trace
associated with the Context. If sampling_decision
is None, then a decision has not yet
been made. Downstream samplers do not need to abide by “no sample” decisions–for example,
an upstream client may choose to never sample, which may not make sense for the client’s
dependencies. On the other hand, if an upstream process has chosen to sample this trace,
then the downstream samplers are expected to respect that decision and also sample the
trace. Otherwise, the full trace would not be able to be reconstructed.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Context
impl<'de> Deserialize<'de> for Context
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl PartialEq<Context> for Context
impl PartialEq<Context> for Context
source§impl TryFrom<&Span> for Context
impl TryFrom<&Span> for Context
§type Error = NoActiveSpan
type Error = NoActiveSpan
impl Copy for Context
impl Eq for Context
impl StructuralEq for Context
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations§
source§impl<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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.