5 stable releases

1.2.1 Oct 15, 2025
1.2.0 Sep 30, 2025
1.1.0 Dec 9, 2024
1.0.1 Aug 22, 2024
1.0.0 Apr 30, 2024

#179 in Web programming

Download history 73683/week @ 2025-10-22 73413/week @ 2025-10-29 82237/week @ 2025-11-05 71976/week @ 2025-11-12 67964/week @ 2025-11-19 61387/week @ 2025-11-26 92219/week @ 2025-12-03 84201/week @ 2025-12-10 67511/week @ 2025-12-17 38287/week @ 2025-12-24 55108/week @ 2025-12-31 114346/week @ 2026-01-07 143573/week @ 2026-01-14 180193/week @ 2026-01-21 246261/week @ 2026-01-28 327104/week @ 2026-02-04

925,841 downloads per month
Used in 51 crates (4 directly)

MIT license

58KB
1.5K SLoC

cf-rustracing

Crates.io: cf-rustracing Documentation License: MIT

OpenTracing API for Rust.

Documentation

Examples

use cf_rustracing::sampler::AllSampler;
use cf_rustracing::tag::Tag;
use cf_rustracing::Tracer;
use std::thread;
use std::time::Duration;

#[tokio::main]
async fn main() {
    // Creates a tracer
    let (tracer, mut span_rx) = Tracer::new(AllSampler);
    {
        // Starts "parent" span
        let parent_span = tracer.span("parent").start_with_state(());
        thread::sleep(Duration::from_millis(10));
        {
            // Starts "child" span
            let mut child_span = tracer
                .span("child_span")
                .child_of(&parent_span)
                .tag(Tag::new("key", "value"))
                .start_with_state(());
    
            child_span.log(|log| {
                log.error().message("a log message");
            });
        } // The "child" span dropped and will be sent to `span_rx`
    } // The "parent" span dropped and will be sent to `span_rx`
    
    println!("# SPAN: {:?}", span_rx.recv().await);
    println!("# SPAN: {:?}", span_rx.recv().await);
}

As an actual usage example of the crate and an implementation of the OpenTracing API, it may be helpful to looking at rustracing_jaeger crate.

References

Dependencies

~3.5–5MB
~96K SLoC