Tracer

Struct Tracer 

Source
pub struct Tracer { /* private fields */ }
Expand description

Tracer for collecting spans

Implementations§

Source§

impl Tracer

Source

pub fn new() -> Self

Source

pub fn record(&self, span: CompletedSpan)

Source

pub fn get_spans(&self) -> Vec<CompletedSpan>

Source

pub fn clear(&self)

Source

pub fn to_jaeger_json(&self) -> String

Export spans in Jaeger format

Examples found in repository?
examples/industry40_tracing.rs (line 64)
40fn main() {
41    let rt = Runtime::new();
42
43    println!("🔍 Distributed Tracing Demo - Industry 4.0");
44    println!("=========================================\n");
45
46    rt.block_on(async move {
47        let ctx = TraceContext::new("order-processing-service");
48
49        println!("Trace ID: {:016x}", ctx.trace_id);
50        println!("Starting order processing...\n");
51
52        // Process multiple batches
53        let batch1 = vec![1001, 1002, 1003];
54        let batch2 = vec![2001, 2002];
55
56        process_batch(&ctx, 1, batch1).await;
57        println!();
58        process_batch(&ctx, 2, batch2).await;
59        println!();
60
61        // Export trace data
62        println!("📤 Jaeger Trace Export");
63        println!("=====================");
64        println!("{}", rt.tracer().to_jaeger_json());
65    });
66}

Trait Implementations§

Source§

impl Clone for Tracer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Tracer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Tracer

§

impl RefUnwindSafe for Tracer

§

impl Send for Tracer

§

impl Sync for Tracer

§

impl Unpin for Tracer

§

impl UnwindSafe for Tracer

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.