Skip to content

ispringle/openmetrics-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenMetrics-rs

Rust Docs Crates.io

An OpenMetrics parser in Rust 🦀

Example

extern crate openmetrics;
use std::fs;

fn main() {
    let unparsed_file = fs::read_to_string("test.prom").expect("cannot read file!");
    openmetrics::parse_metrics(unparsed_file);
}

Sample metrics data:

{
    "go_goroutines": MetricGroup {
        help: "Number of goroutines that currently exist.",
        type: GAUGE,
        metric: Metric(
            [
                {
                    "value": "9",
                },
            ],
        ),
    },
}

TODO

  • bin -> lib
  • consume URLs
  • consume specific file
  • methods to specify specific alternative output (JSON/YAML/TOML/string/etc)
  • Add label and metric logic to convert parsed pest data into usable data
  • parse labels within each metricLine
  • reconsider best way to handle labels and special labels (such as quartile)