/minitrace-rust

A high-performance timeline tracing library for Rust, used by TiKV

Primary LanguageRustApache License 2.0Apache-2.0

minitrace

Actions Status Coverage Status Documentation Crates.io LICENSE

A high-performance and ergonomic timeline tracing library for Rust. Builtin supports Jaeger and Datadog.

Usage

[dependencies]
minitrace = "0.4"
minitrace-jaeger = "0.4"
use minitrace::prelude::*;
use futures::executor::block_on;

let (root, collector) = Span::root("root");

{
    let _child_span_1 = Span::enter_with_parent("child span 1", &root);
    // some work
}

drop(root);
let records: Vec<SpanRecord> = block_on(collector.collect());

Read the docs for more details.

Examples

Setup Jaeger

docker run --rm -d -p6831:6831/udp -p16686:16686 --name jaeger jaegertracing/all-in-one:latest

Run examples

cargo run --example synchronous
# or
cargo run --example asynchronous

Open http://localhost:16686 to see the results.

Synchronous

Jaeger Synchronous

Asynchronous

Jaeger Asynchronous

Benchmark

Benchmark platform is Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz on CentOS 7.

> cargo criterion

100 spans/Tokio Tracing   time:   [147.64 us 148.80 us 150.25 us]
100 spans/Rustracing      time:   [36.486 us 36.690 us 36.941 us]
100 spans/minitrace       time:   [3.7514 us 3.7564 us 3.7689 us]

Benchmark