#jaeger #tracing #spans #opentracing #client #top #created

cf-rustracing-jaeger

Jaeger client library created on top of rustracing

3 stable releases

1.2.0 Jul 16, 2024
1.1.0 May 3, 2024
1.0.0 Apr 30, 2024

#218 in Debugging

Download history 2951/week @ 2024-09-20 2695/week @ 2024-09-27 3228/week @ 2024-10-04 3144/week @ 2024-10-11 3584/week @ 2024-10-18 3739/week @ 2024-10-25 4292/week @ 2024-11-01 5837/week @ 2024-11-08 8801/week @ 2024-11-15 8411/week @ 2024-11-22 7989/week @ 2024-11-29 7972/week @ 2024-12-06 8105/week @ 2024-12-13 4359/week @ 2024-12-20 5235/week @ 2024-12-27 9171/week @ 2025-01-03

28,313 downloads per month
Used in 2 crates

MIT license

79KB
989 lines

cf-rustracing-jaeger

Crates.io: rustracing_jaeger Documentation License: MIT

Jaeger client library created on top of cf-rustracing.

Documentation

Examples

Basic Usage

use cf_rustracing::sampler::AllSampler;
use cf_rustracing_jaeger::Tracer;
use cf_rustracing_jaeger::reporter::JaegerCompactReporter;
use std::net::Ipv4Addr;

#[tokio::main]
async fn main() {
    // Creates a tracer
    let (tracer, mut span_rx) = Tracer::new(AllSampler);
    {
        let span = tracer.span("sample_op").start();
        // Do something
    
    } // The dropped span will be sent to `span_rx`
    
    let span = span_rx.recv().await.unwrap();
    assert_eq!(span.operation_name(), "sample_op");
    
    // Reports this span to the local jaeger agent
    let reporter = JaegerCompactReporter::new(
        "sample_service",
        (Ipv4Addr::LOCALHOST, 6831).into(),
        (Ipv4Addr::LOCALHOST, 0).into(),
    )
    .await
    .unwrap();
    
    reporter.report(&[span]).await.unwrap();
}

Executes report.rs example

# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest

# Report example spans
$ cargo run --example report

# View spans (see the image below)
$ firefox http://localhost:16686/

Jaeger UI

References

Dependencies

~3–12MB
~124K SLoC