2 releases

0.1.1 Apr 12, 2024
0.1.0 Mar 15, 2024

#798 in Debugging

Download history 104/week @ 2024-03-14 10/week @ 2024-03-21 16/week @ 2024-03-28 7/week @ 2024-04-04 147/week @ 2024-04-11

183 downloads per month
Used in 4 crates

Apache-2.0

130KB
3.5K SLoC

Tracing crate

Provides logging, metrics, memory and performance profiling

Have the lowest impact on the critical path of execution while providing great visibility, tracing focusses on providing predictable performance for high performance applications. It's primary client is Legion Engine, which runs a distributed, highly compute demanding workloads.

Contrary to other tracing crates, tracing does not provide hooks for individual events but rather a stream of events, internally it leverages transit to serialize the events into a binary format. meant to be consumed later on in process but can also be sent efficiently over the wire.

Examples

use micromegas_tracing::{
   span_scope, info, warn, error, debug, imetric, fmetric, guards, event,
};

// Initialize tracing, here with a null event sink, see `lgn-telemetry-sink` crate for a proper implementation
// libraries don't need (and should not) setup any TracingSystemGuard
let _tracing_guard = guards::TracingSystemGuard::new(
    8 * 1024 * 1024,
    1024 * 1024,
    16 * 1024 * 1024,
    std::sync::Arc::new(event::NullEventSink {})
);
let _thread_guard = guards::TracingThreadGuard::new();

// Create a span scope, this will complete when the scope is dropped, and provide the time spent in the scope
// Behind the scene this uses a thread local storage
// on an i9-11950H this takes around 40ns
span_scope!("main");

// Logging
info!("Hello world");
warn!("Hello world");
error!("Hello world");
debug!("Hello world");

// Metrics
imetric!("name", "unit", 0);
fmetric!("name", "unit", 0.0);

Dependencies

~4MB
~80K SLoC