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

#309 in Parser implementations

Download history 49120/week @ 2024-11-15 44106/week @ 2024-11-22 45299/week @ 2024-11-29 52529/week @ 2024-12-06 46071/week @ 2024-12-13 22244/week @ 2024-12-20 19991/week @ 2024-12-27 44275/week @ 2025-01-03 55451/week @ 2025-01-10 52437/week @ 2025-01-17 53048/week @ 2025-01-24 57018/week @ 2025-01-31 57707/week @ 2025-02-07 63417/week @ 2025-02-14 59871/week @ 2025-02-21 47348/week @ 2025-02-28

239,479 downloads per month
Used in 11 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–10MB
~102K SLoC