#prometheus-exporter

prometheus-measures-exporter

Prometheus exporters with measures helpers

1 unstable release

0.0.1 Jul 14, 2022

#41 in #prometheus-exporter

Download history 6/week @ 2024-07-13 28/week @ 2024-07-20 19/week @ 2024-07-27 4/week @ 2024-08-03 1/week @ 2024-08-10 14/week @ 2024-08-17 15/week @ 2024-08-24 67/week @ 2024-08-31 48/week @ 2024-09-07 44/week @ 2024-09-14 28/week @ 2024-09-21 54/week @ 2024-09-28 73/week @ 2024-10-05 54/week @ 2024-10-12

212 downloads per month

Apache-2.0

10KB
184 lines

Prometheus measures exporter

Start http service for export metrics

start_prometheus_exporter();

Measure

let counter = create_and_register_measurer::<IntCounter, _>(
         &prometheus::default_registry(),
         Opts::new("name", "help").const_labels(
             vec![("label".to_string(), "value".to_string())]
                 .into_iter()
                 .collect(),
         ) 
);
counter.inc();

Measures by labels


let mut measures = MeasurersByLabel::<String, IntCounter, Opts>::new(
    &prometheus::default_registry(),
    Box::new(|key| {
                Opts::new("name", "help").const_labels(
                    vec![("label".to_string(), key.to_string())]
                        .into_iter()
                        .collect(),
                )
            }),
        );
let counter = measures.measurer("some_measure".to_owned());
counter.inc();

Dependencies

~6–13MB
~159K SLoC