Function prometheus_client::encoding::text::encode_eof

source ·
pub fn encode_eof<W>(writer: &mut W) -> Result<(), Error>
where W: Write,
Expand description

Encode the EOF marker into the provided Writer using the OpenMetrics text format.

Note: This function is used to mark/signal the end of the exposition.

§Examples

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

// Encode registry into the buffer
let mut buffer = String::new();
encode_registry(&mut buffer, &registry)?;

// Encode EOF marker to complete the message
encode_eof(&mut buffer)?;