14 releases

new 0.2.3 Dec 11, 2024
0.2.2 Nov 29, 2024
0.2.0 Oct 3, 2024
0.1.5 Jul 19, 2024
0.1.0 Mar 15, 2024

#936 in Debugging

Download history 27/week @ 2024-08-26 169/week @ 2024-09-02 11/week @ 2024-09-09 238/week @ 2024-09-16 55/week @ 2024-09-23 185/week @ 2024-09-30 18/week @ 2024-10-07 13/week @ 2024-10-14 8/week @ 2024-10-21 7/week @ 2024-11-04 167/week @ 2024-11-18 141/week @ 2024-11-25 32/week @ 2024-12-02 221/week @ 2024-12-09

561 downloads per month
Used in 4 crates

Apache-2.0

165KB
4K 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 was originaly designed for video game engines.

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

~4.5MB
~85K SLoC