Skip to main content

prometheus_labels/
prometheus_labels.rs

1//! A sample application sending ad-hoc metrics to prometheus.
2
3use dipstick::*;
4use std::time::Duration;
5
6fn main() {
7    let metrics = Prometheus::push_to("http://localhost:9091/metrics/job/prometheus_example")
8        .expect("Prometheus Socket")
9        .named("my_app")
10        .metrics();
11
12    AppLabel::set("abc", "456");
13    ThreadLabel::set("xyz", "123");
14
15    loop {
16        metrics.counter("counter_a").count(123);
17        metrics.timer("timer_a").interval_us(2000000);
18        std::thread::sleep(Duration::from_millis(40));
19    }
20}