pub struct SpanCollector { /* private fields */ }Expand description
Thread-local span collector. Accumulates completed spans and tracks the active span stack for automatic parent assignment.
Implementations§
Source§impl SpanCollector
impl SpanCollector
pub fn new() -> Self
Sourcepub fn start(&mut self, kind: SpanKind, name: String) -> u64
pub fn start(&mut self, kind: SpanKind, name: String) -> u64
Start a new span. Returns the span ID.
Sourcepub fn set_metadata(&mut self, span_id: u64, key: &str, value: Value)
pub fn set_metadata(&mut self, span_id: u64, key: &str, value: Value)
Attach metadata to an open span.
Sourcepub fn current_span_id(&self) -> Option<u64>
pub fn current_span_id(&self) -> Option<u64>
Get the current active span ID (if any).
Sourcepub fn take_spans(&mut self) -> Vec<Span>
pub fn take_spans(&mut self) -> Vec<Span>
Take all completed spans (drains the collector).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpanCollector
impl RefUnwindSafe for SpanCollector
impl Send for SpanCollector
impl Sync for SpanCollector
impl Unpin for SpanCollector
impl UnsafeUnpin for SpanCollector
impl UnwindSafe for SpanCollector
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