#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

#307 in Parser implementations

Download history 37123/week @ 2024-07-29 41957/week @ 2024-08-05 48953/week @ 2024-08-12 38649/week @ 2024-08-19 45272/week @ 2024-08-26 50925/week @ 2024-09-02 45424/week @ 2024-09-09 45419/week @ 2024-09-16 45828/week @ 2024-09-23 49661/week @ 2024-09-30 51739/week @ 2024-10-07 53194/week @ 2024-10-14 58614/week @ 2024-10-21 47663/week @ 2024-10-28 57622/week @ 2024-11-04 47093/week @ 2024-11-11

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