1 unstable release
0.0.1 | Jul 14, 2022 |
---|
#44 in #prometheus-exporter
197 downloads per month
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