2 releases

0.0.22 Jun 24, 2024
0.0.21 May 11, 2024

#91 in #monitor

Download history 22/week @ 2024-11-16 28/week @ 2024-11-23 531/week @ 2024-11-30 528/week @ 2024-12-07 805/week @ 2024-12-14 1/week @ 2024-12-21 8/week @ 2024-12-28 135/week @ 2025-01-04 145/week @ 2025-01-11 31/week @ 2025-01-18 1/week @ 2025-01-25

129 downloads per month

MIT/Apache

185KB
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–14MB
~148K SLoC