1 个不稳定版本

0.1.0 2018年12月11日

#10 in #opentracing


2 个 crate 中使用

MIT 许可证

6KB
211

Opentracing Rust 客户端

Crates.io MIT licensed Travis Build Status

功能

  • 支持 tokio 和 futures

快速入门

TBD

示例

fn main() {
    tokio::run(lazy(move || {
        // build and serve tracer
        let mut tracer = JaegerTracer::builder()
            .probabilistic_sampler(0.50)
            .udp_remote_reporter(
                "jaeger_example",
                "127.0.0.1:6831".parse().unwrap(),
                TransportProtocol::ThriftCompact,
                Duration::from_millis(500),
            )
            .build_and_serve();
            
        // clone tracer into event callback
        // start tracing
        tokio::spawn(lazy(move || {
            let span = tracer.span("hello 1").start();

            std::thread::sleep(std::time::Duration::from_secs(1));

            let child_span = tracer.span("testing 1").child_of(&span);
            {
                let _child_span = child_span.start();
                std::thread::sleep(std::time::Duration::from_secs(2));
            }

            let child_span = tracer.span("testing 2").child_of(&span);
            {
                let _child_span = child_span.start();
                std::thread::sleep(std::time::Duration::from_secs(2));
            }

            std::thread::sleep(std::time::Duration::from_secs(2));

            Ok(())
        }));

        Ok(())
    }));
}

许可证

本项目采用MIT 许可证

依赖关系

~3MB
~45K SLoC