[][src]Crate prometheus_static_metric

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

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.