#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

#293 in Parser implementations

Download history 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 48783/week @ 2024-11-11 47471/week @ 2024-11-18 44914/week @ 2024-11-25 47156/week @ 2024-12-02 53124/week @ 2024-12-09 42811/week @ 2024-12-16 17687/week @ 2024-12-23 22452/week @ 2024-12-30

139,584 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
~103K SLoC