pub struct Tracer<S, T> { /* private fields */ }Expand description
Tracer.
§Examples
use cf_rustracing::Tracer;
use cf_rustracing::sampler::AllSampler;
let (tracer, mut span_rx) = Tracer::new(AllSampler);
{
let _span = tracer.span("foo").start_with_state(());
}
let span = span_rx.recv().await.unwrap();
assert_eq!(span.operation_name(), "foo");Implementations§
Source§impl<S: Sampler<T>, T: Send + 'static> Tracer<S, T>
impl<S: Sampler<T>, T: Send + 'static> Tracer<S, T>
Sourcepub fn new(sampler: S) -> (Self, SpanReceiver<T>)
pub fn new(sampler: S) -> (Self, SpanReceiver<T>)
Makes a new Tracer instance with an unbounded tokio::sync::mpsc channel.
Source§impl<S: Sampler<T>, T> Tracer<S, T>
impl<S: Sampler<T>, T> Tracer<S, T>
Sourcepub fn with_consumer<C: SpanConsumer<T> + 'static>(
sampler: S,
consumer: C,
) -> Self
pub fn with_consumer<C: SpanConsumer<T> + 'static>( sampler: S, consumer: C, ) -> Self
Makes a new Tracer instance with a custom consumer implementation.
Trait Implementations§
Auto Trait Implementations§
impl<S, T> Freeze for Tracer<S, T>
impl<S, T> !RefUnwindSafe for Tracer<S, T>
impl<S, T> Send for Tracer<S, T>
impl<S, T> Sync for Tracer<S, T>
impl<S, T> Unpin for Tracer<S, T>
impl<S, T> UnsafeUnpin for Tracer<S, T>
impl<S, T> !UnwindSafe for Tracer<S, T>
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