prometheus-measures-exporter

Crates.ioprometheus-measures-exporter
lib.rsprometheus-measures-exporter
version0.0.1
sourcesrc
created_at2022-07-14 10:16:04.34308
updated_at2022-07-14 10:16:04.34308
descriptionPrometheus exporters with measures helpers
homepage
repositoryhttps://github.com/cheetah-game-platform/prometheus-measures-exporter
max_upload_size
id625612
size21,984
Kviring Alexey (avkviring)

documentation

README

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();
Commit count: 4

cargo fmt