#prometheus #parser

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

#309 in Parser implementations

Download history 138784/week @ 2026-01-24 159955/week @ 2026-01-31 178110/week @ 2026-02-07 180548/week @ 2026-02-14 217979/week @ 2026-02-21 239819/week @ 2026-02-28 280172/week @ 2026-03-07 245281/week @ 2026-03-14 218490/week @ 2026-03-21 241396/week @ 2026-03-28 260162/week @ 2026-04-04 219185/week @ 2026-04-11 204277/week @ 2026-04-18 217848/week @ 2026-04-25 180908/week @ 2026-05-02 182569/week @ 2026-05-09

823,082 downloads per month
Used in 31 crates (22 directly)

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–6MB
~97K SLoC