pub struct Tracer { /* private fields */ }Expand description
Tracer for collecting spans
Implementations§
Source§impl Tracer
impl Tracer
pub fn new() -> Self
pub fn record(&self, span: CompletedSpan)
pub fn get_spans(&self) -> Vec<CompletedSpan>
pub fn clear(&self)
Sourcepub fn to_jaeger_json(&self) -> String
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)