#prometheus #text-format #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

#307 in Parser implementations

Download history 91456/week @ 2025-10-15 94103/week @ 2025-10-22 81839/week @ 2025-10-29 95770/week @ 2025-11-05 83308/week @ 2025-11-12 108281/week @ 2025-11-19 84525/week @ 2025-11-26 122916/week @ 2025-12-03 113680/week @ 2025-12-10 87064/week @ 2025-12-17 50962/week @ 2025-12-24 57637/week @ 2025-12-31 111938/week @ 2026-01-07 111364/week @ 2026-01-14 133357/week @ 2026-01-21 139344/week @ 2026-01-28

514,608 downloads per month
Used in 28 crates (20 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
~99K SLoC