19 releases

0.6.0 Apr 5, 2022
0.5.1 Jan 13, 2021
0.5.0 Oct 25, 2020
0.4.0 Feb 3, 2020
0.1.4 Oct 19, 2017

#315 in Web programming

Download history 11849/week @ 2024-09-11 13531/week @ 2024-09-18 18128/week @ 2024-09-25 16846/week @ 2024-10-02 19456/week @ 2024-10-09 20885/week @ 2024-10-16 21233/week @ 2024-10-23 24678/week @ 2024-10-30 24753/week @ 2024-11-06 25978/week @ 2024-11-13 25328/week @ 2024-11-20 20466/week @ 2024-11-27 19672/week @ 2024-12-04 22861/week @ 2024-12-11 16088/week @ 2024-12-18 7197/week @ 2024-12-25

69,429 downloads per month
Used in 46 crates (10 directly)

MIT license

54KB
1K SLoC

rustracing

Crates.io: rustracing Documentation Actions Status Coverage Status License: MIT

OpenTracing API for Rust.

Documentation

Examples

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

// Creates a tracer
let (span_tx, span_rx) = crossbeam_channel::bounded(10);
let tracer = Tracer::with_sender(AllSampler, span_tx);
{
    // 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`

// Outputs finished spans to the standard output
while let Ok(span) = span_rx.try_recv() {
    println!("# SPAN: {:?}", span);
}

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

~1.9–7MB
~59K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy