#prometheus-exporter

prometheus-measures-exporter

Prometheus exporters with measures helpers

1 unstable release

0.0.1 Jul 14, 2022

#44 in #prometheus-exporter

Download history 13/week @ 2024-07-23 13/week @ 2024-07-30 5/week @ 2024-08-06 2/week @ 2024-08-13 15/week @ 2024-08-20 38/week @ 2024-08-27 67/week @ 2024-09-03 40/week @ 2024-09-10 29/week @ 2024-09-17 36/week @ 2024-09-24 46/week @ 2024-10-01 86/week @ 2024-10-08 41/week @ 2024-10-15 48/week @ 2024-10-22 41/week @ 2024-10-29 56/week @ 2024-11-05

197 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
~158K SLoC