#prometheus-exporter

prometheus-measures-exporter

Prometheus exporters with measures helpers

1 unstable release

0.0.1 Jul 14, 2022

#45 in #prometheus-exporter

Download history 45/week @ 2024-09-13 30/week @ 2024-09-20 51/week @ 2024-09-27 48/week @ 2024-10-04 68/week @ 2024-10-11 51/week @ 2024-10-18 31/week @ 2024-10-25 60/week @ 2024-11-01 72/week @ 2024-11-08 52/week @ 2024-11-15 95/week @ 2024-11-22 68/week @ 2024-11-29 33/week @ 2024-12-06 15/week @ 2024-12-13 11/week @ 2024-12-20 2/week @ 2024-12-27

73 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

~7–13MB
~161K SLoC