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§
- Bucket for histogram metric.
- Metric label.
- Metric.
- Concrete metrics.
- Summary quantile.
- Unix timestamp.
Structs§
- This crate specific error type.
- Metrics gatherer.
- Collector registry.
Enums§
- The list of the possible error kinds
Traits§
- This trait allows for collecting metrics.
Functions§
- Returns the global default
Gatherer
. - Returns the global default
Registry
.
Type Aliases§
- This crate specific
Result
type.