Struct SpanContext
pub struct SpanContext {
pub trace_id: TraceId,
pub span_id: SpanId,
}
Fields§
§trace_id: TraceId
The trace ID this span belongs to
span_id: SpanId
The unique ID of this span
Implementations§
§impl SpanContext
impl SpanContext
pub fn new(trace_id: TraceId, span_id: SpanId) -> SpanContext
pub fn new(trace_id: TraceId, span_id: SpanId) -> SpanContext
pub fn generate() -> SpanContext
pub fn generate() -> SpanContext
Creates a new SpanContext
with a TraceId
generated with the state in the collector.
Returns 0 if the collector has not been initialized via crate::collector::set_exporter
.
§Examples
use veecle_telemetry::*;
let random = SpanContext::generate();
pub fn from_span(span: &Span) -> Option<SpanContext>
pub fn from_span(span: &Span) -> Option<SpanContext>
pub fn current() -> Option<SpanContext>
pub fn current() -> Option<SpanContext>
Creates a SpanContext
from the current local parent span. If there is no
local parent span, this function will return None
.
§Examples
use veecle_telemetry::*;
let span = Span::root("root", SpanContext::generate(), &[]);
let _guard = span.entered();
let span_context = SpanContext::current();
Trait Implementations§
§impl Clone for SpanContext
impl Clone for SpanContext
§fn clone(&self) -> SpanContext
fn clone(&self) -> SpanContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for SpanContext
impl Debug for SpanContext
§impl<'de> Deserialize<'de> for SpanContext
impl<'de> Deserialize<'de> for SpanContext
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpanContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpanContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Hash for SpanContext
impl Hash for SpanContext
§impl Ord for SpanContext
impl Ord for SpanContext
§impl PartialEq for SpanContext
impl PartialEq for SpanContext
§impl PartialOrd for SpanContext
impl PartialOrd for SpanContext
§impl Serialize for SpanContext
impl Serialize for SpanContext
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy 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
Mutably borrows from an owned value. Read more