#metrics #tokio #run-time #memory #open-telemetry #register #meter

runtime-otel-metrics

Meter your tokio runtime and process memory with OpenTelemetry

2 unstable releases

0.2.0 Jun 9, 2024
0.1.0 Apr 20, 2024

#716 in Debugging

Download history 9/week @ 2024-07-27 12/week @ 2024-09-21 16/week @ 2024-09-28

129 downloads per month

MIT/Apache

11KB
177 lines

runtime-otel-metrics

runtime-otel-metrics is an experimental crate that enables you to meter your tokio runtime and memory usage with OpenTelemetry. For tokio metrics it leans on tokio's unstable runtime metrics. For memory usage we use the memory-stats crate.

Usage

To use the tokio feature, you must compile with the rustc flag --cfg tokio_unstable.

// Register Tokio metrics with OpenTelemetry
runtime_otel_metrics::tokio_rt::register_tokio_metrics(
    tokio::runtime::Handle::current(),
    &opentelemetry::global::meter("tokio"),
)?;

// Register memory metrics
runtime_otel_metrics::memory::register(&opentelemetry::global::meter("memory"))?;

Similar crates

Dependencies

~3–11MB
~104K SLoC