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

#163 in Web programming

Download history 55888/week @ 2025-10-02 55302/week @ 2025-10-09 58705/week @ 2025-10-16 77426/week @ 2025-10-23 73800/week @ 2025-10-30 81041/week @ 2025-11-06 71841/week @ 2025-11-13 65408/week @ 2025-11-20 66944/week @ 2025-11-27 92797/week @ 2025-12-04 82321/week @ 2025-12-11 58853/week @ 2025-12-18 37893/week @ 2025-12-25 67314/week @ 2026-01-01 117358/week @ 2026-01-08 125533/week @ 2026-01-15

354,022 downloads per month
Used in 43 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
~95K SLoC