#prometheus #parser #text-format #scrape

prometheus-parse

A simple parser for the Prometheus text format

6 releases

0.2.5 Dec 9, 2023
0.2.4 Mar 19, 2023
0.2.3 Jun 17, 2022
0.2.2 Oct 20, 2021
0.2.1 Oct 5, 2020

#267 in Parser implementations

Download history 29692/week @ 2024-03-14 34593/week @ 2024-03-21 34185/week @ 2024-03-28 38174/week @ 2024-04-04 34560/week @ 2024-04-11 32978/week @ 2024-04-18 31431/week @ 2024-04-25 30231/week @ 2024-05-02 31117/week @ 2024-05-09 31337/week @ 2024-05-16 38945/week @ 2024-05-23 39441/week @ 2024-05-30 30035/week @ 2024-06-06 33033/week @ 2024-06-13 34605/week @ 2024-06-20 24480/week @ 2024-06-27

128,604 downloads per month
Used in 10 crates

Apache-2.0

27KB
651 lines

prometheus-parse

Simple but effective Rust parser for the Prometheus scrape format.

let body = reqwest::get("https://prometheus.example.com/metrics")?
    .text()?;
let lines: Vec<_> = body.lines().map(|s| Ok(s.to_owned)).collect();

let metrics = prometheus_parse::Scrape::parse(lines.into_iter())?;

Attribution

This crate is 99.99% lifted from prometheus-scrape with some minor API changes and a GitHub repo to encourage PRs.

License

Apache License 2.0 - same as original project

Dependencies

~4–12MB
~103K SLoC