Expand description
This crate provides staticly built metrics to your Prometheus application.
This is useful since it reduces the amount of branching and processing needed at runtime to collect metrics.
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate prometheus;
use prometheus::{self, IntCounter, TextEncoder, Encoder};
lazy_static! {
static ref HIGH_FIVE_COUNTER: IntCounter =
register_int_counter!("highfives", "Number of high fives recieved").unwrap();
}
HIGH_FIVE_COUNTER.inc();
assert_eq!(HIGH_FIVE_COUNTER.get(), 1);
Is it reccomended that you consult the prometheus
documentation for more information.
Macrosยง
- auto_
flush_ from - Instantiate a auto flush able static metric struct from a HistogramVec or CounterVec.
- make_
auto_ flush_ static_ metric - Build auto flush able static metrics. refer to https://github.com/tikv/rust-prometheus/tree/master/static-metric for more info.
- make_
static_ metric - Build static metrics.
- register_
static_ counter_ vec - Register a
CounterVec
and create static metrics from it. - register_
static_ gauge_ vec - Register a
GaugeVec
and create static metrics from it. - register_
static_ histogram_ vec - Register a
HistogramVec
and create static metrics from it. - register_
static_ int_ counter_ vec - Register a
IntCounterVec
and create static metrics from it. - register_
static_ int_ gauge_ vec - Register a
IntGaugeVec
and create static metrics from it.