prom_text_format_parser

Crates.ioprom_text_format_parser
lib.rsprom_text_format_parser
version0.1.0
sourcesrc
created_at2023-12-28 18:59:13.44013
updated_at2023-12-28 18:59:13.44013
descriptionA crate to parse and print Prometheus exposition text format
homepage
repositoryhttps://github.com/dovreshef/prom_text_format_parser
max_upload_size
id1082611
size81,535
Dov Reshef (dovreshef)

documentation

https://docs.rs/prom_text_format_parser

README

GitHub Workflow Status (with event) docs.rs Crates.io Codecov Crates.io

This is a parser and printer for the Prometheus exposition text format.

See here for a detailed description of the format.

Usage example:

    let path = std::env::args().nth(1).expect("A path to scrape text");
    let text = std::fs::read_to_string(path).expect("file read");
    let mut scrape = Scrape::parse(&text).expect("valid scrape");

    // Add a label to all metrics
    scrape.add_label("source", "invalid");
    // Remove a label from all metrics
    scrape.remove_label("source", "invalid");

    // format the scrape in the Prometheus exposition text format
    let rendered = format!("{scrape}");
    assert_eq!(text, rendered);

Commit count: 2

cargo fmt