1 unstable release

0.0.21 May 11, 2024

#86 in #state

Download history 195/week @ 2024-05-09 11/week @ 2024-05-16 5/week @ 2024-05-23

211 downloads per month

MIT/Apache

175KB
3K SLoC

measured-tokio

Tokio metrics support for measured.


lib.rs:

Monitor a tokio runtime.

Usage

use measured::MetricGroup;

#[derive(MetricGroup)]
#[metric(new())]
struct MyAppMetrics {
    #[cfg(tokio_unstable)]
    #[metric(namespace = "tokio")]
    #[metric(init = measured_tokio::RuntimeCollector::current())]
    tokio: measured_tokio::RuntimeCollector,

    // other metrics
}}

#[tokio::main]
async fn main() {
    let metrics = MyAppMetrics::new();

    // when you run metrics.collect_group_into(...), you will sample tokio to get runtime state.

    # drop(metrics);
}

Dependencies

~5–15MB
~165K SLoC