[][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

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.