Skip to main content

encode

Function encode 

Source
pub fn encode<W>(writer: &mut W, registry: &Registry) -> Result<(), Error>
where W: Write,
Expand description

Encode the metrics registered with the provided Registry into the provided Writer using the Prometheus text format (version 0.0.4).

ยงExamples

let mut registry = Registry::default();
let counter: Counter = Counter::default();
registry.register("my_counter", "This is my counter", counter.clone());

let mut buffer = String::new();
encode(&mut buffer, &registry)?;