24 releases

new 0.9.0 Apr 17, 2026
0.8.0 Mar 20, 2026
0.7.0 Jun 12, 2024
0.5.1 Jan 18, 2024
0.1.3 Mar 24, 2023

#1240 in Concurrency

Download history 154/week @ 2025-12-26 874/week @ 2026-01-02 966/week @ 2026-01-09 703/week @ 2026-01-16 1357/week @ 2026-01-23 829/week @ 2026-01-30 817/week @ 2026-02-06 1675/week @ 2026-02-13 1746/week @ 2026-02-20 2318/week @ 2026-02-27 3223/week @ 2026-03-06 2827/week @ 2026-03-13 3951/week @ 2026-03-20 2163/week @ 2026-03-27 3321/week @ 2026-04-03 5308/week @ 2026-04-10

15,430 downloads per month
Used in 17 crates (7 directly)

Apache-2.0

110KB
2K SLoC

metriken

Easily registered distributed metrics.

metriken allows you to easily declare static metrics throughout your codebase. Then, when you want to expose those metrics, you can access them all in one place.

use metriken::{metric, Counter, Gauge, Value};

/// A counter metric named "<crate name>::COUNTER"
#[metric]
static COUNTER: Counter = Counter::new();

/// A gauge metric named "my.metric"
#[metric(name = "my.metric")]
static GAUGE: Gauge = Gauge::new();

fn main() {
    COUNTER.increment();

    for metric in &metriken::metrics() {
        let name = metric.name();

        match metric.value() {
            Some(Value::Counter(val)) => println!("{name}: {val}"),
            Some(Value::Gauge(val)) => println!("{name}: {val}"),
            _ => println!("{name}: <custom>")
        }
    }
}

Code updating the metrics can always access them without needing to go through any indirections. (It just means accessing a static!). Using linkme, the metrics are all gathered into a single global array that can then be used to read all of them and expose them.

Dependencies

~3–4MB
~88K SLoC