#prometheus #parser

prometheus-parse

A simple parser for the Prometheus text format

5 releases

new 0.2.4 Mar 19, 2023
0.2.3 Jun 17, 2022
0.2.2 Oct 20, 2021
0.2.1 Oct 5, 2020
0.2.0 Oct 5, 2020

#211 in Parser implementations

Download history 8047/week @ 2022-11-27 10602/week @ 2022-12-04 8898/week @ 2022-12-11 8023/week @ 2022-12-18 6544/week @ 2022-12-25 7592/week @ 2023-01-01 9056/week @ 2023-01-08 9149/week @ 2023-01-15 6221/week @ 2023-01-22 10073/week @ 2023-01-29 10908/week @ 2023-02-05 12647/week @ 2023-02-12 12702/week @ 2023-02-19 10183/week @ 2023-02-26 10957/week @ 2023-03-05 10740/week @ 2023-03-12

45,362 downloads per month
Used in aptos-node-checker

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

~2–3MB
~67K SLoC