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

#196 in Parser implementations

Download history 27498/week @ 2023-12-18 10712/week @ 2023-12-25 18085/week @ 2024-01-01 26332/week @ 2024-01-08 33086/week @ 2024-01-15 31291/week @ 2024-01-22 29841/week @ 2024-01-29 28866/week @ 2024-02-05 29590/week @ 2024-02-12 36460/week @ 2024-02-19 33490/week @ 2024-02-26 29113/week @ 2024-03-04 31200/week @ 2024-03-11 32551/week @ 2024-03-18 31207/week @ 2024-03-25 38461/week @ 2024-04-01

134,274 downloads per month
Used in 8 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–12MB
~103K SLoC