#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

#318 in Parser implementations

Download history 50744/week @ 2024-10-08 56659/week @ 2024-10-15 56361/week @ 2024-10-22 48992/week @ 2024-10-29 55324/week @ 2024-11-05 48831/week @ 2024-11-12 47469/week @ 2024-11-19 43435/week @ 2024-11-26 50147/week @ 2024-12-03 49373/week @ 2024-12-10 39904/week @ 2024-12-17 17808/week @ 2024-12-24 28351/week @ 2024-12-31 48635/week @ 2025-01-07 58529/week @ 2025-01-14 41953/week @ 2025-01-21

182,798 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–11MB
~102K SLoC