pub struct SpanContext {
pub trace_id: TraceId,
pub span_id: SpanId,
}Fields§
§trace_id: TraceIdThe trace ID this span belongs to
span_id: SpanIdThe unique ID of this span
Implementations§
Source§impl SpanContext
impl SpanContext
Sourcepub fn generate() -> Self
pub fn generate() -> Self
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();Sourcepub fn current() -> Option<Self>
pub fn current() -> Option<Self>
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::new("root", &[]);
let _guard = span.entered();
let span_context = SpanContext::current();
assert!(span_context.is_some());Trait Implementations§
Source§impl Clone for SpanContext
impl Clone for SpanContext
Source§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 moreSource§impl Debug for SpanContext
impl Debug for SpanContext
Source§impl<'de> Deserialize<'de> for SpanContext
impl<'de> Deserialize<'de> for SpanContext
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for SpanContext
impl Hash for SpanContext
Source§impl Ord for SpanContext
impl Ord for SpanContext
Source§fn cmp(&self, other: &SpanContext) -> Ordering
fn cmp(&self, other: &SpanContext) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SpanContext
impl PartialEq for SpanContext
Source§impl PartialOrd for SpanContext
impl PartialOrd for SpanContext
Source§impl Serialize for SpanContext
impl Serialize for SpanContext
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