Crate prometheus_exporter_base[][src]

Expand description

This crate simplifies the generation of valid Prometheus metrics. You should start by building a PrometheusMetric and then adding as many PrometheusInstance as needed.

PrometheusMetric specifies the counter name, type and help. Each PrometheusInstance specifies the value and the optional labels and timestamp.

This crate aslo gives you a zero boilerplate hyper server behind the hyper_server feature gate, check render_prometheus and the example folder for this feature.


Basic usage:

use prometheus_exporter_base::prelude::*;

let rendered_string = PrometheusMetric::build()
    .with_help("Size of the folder")
            .with_label("folder", "/var/log")
            .expect("error getting the UNIX epoch"),





This trait should be implemented by any instance able to render itself according to Prometheus specifications.