Crate prometrics

Source
Expand description

Client library for exposing prometheus metrics.

Currently this crate only support text format for exposing metrics.

§Examples

use prometrics::default_gatherer;
use prometrics::metrics::{CounterBuilder, GaugeBuilder};

let counter = CounterBuilder::new("count")
    .default_registry()
    .finish()
    .unwrap();
let gauge = GaugeBuilder::new("gauge")
    .label("foo", "bar")
    .default_registry()
    .finish()
    .unwrap();

 counter.increment();
 gauge.set(12.3);

 let metrics = default_gatherer().lock().unwrap().gather();
 assert_eq!(
    metrics.to_text(),
    format!("{}\n{}\n{}\n{}\n",
            "# TYPE count counter",
            "count 1",
            "# TYPE gauge gauge",
            "gauge{foo=\"bar\"} 12.3"));

§References

Modules§

Structs§

Enums§

  • The list of the possible error kinds

Traits§

  • This trait allows for collecting metrics.

Functions§

Type Aliases§

  • This crate specific Result type.