Crate prom_text_format_parser

Source
Expand description

The Prometheus exposition format is taken from here: https://prometheus.io/docs/instrumenting/exposition_formats/

Structs§

Float
Float is a float as represented by Go’s ParseFloat() function. In addition to standard numerical values, NaN, +Inf, and -Inf are valid values representing not a number, positive infinity, and negative infinity, respectively. Since it’s very hard to render float as Go renders them in Rust, and we don’t need the actual value - we keep the value as String, and only validate on parsing that it’s a valid float.
Label
A single label in a sample.
Labels
A set of labels identifying a sample.
Metric
A metric.
MetricError
A failure to assemble multiple lines into a metric. Composed of the line the error occurred and the error message.
Sample
A representation of a sample line, containing the labels and the value.
Scrape
A single scrape. Parses a textual scrape into a vector of metrics. Implements Display to print the metrics in the Prometheus exposition text format.
Value
A Prometheus metric value, for a specific combination of labels.

Enums§

ScrapeParseError
The errors that can result from failure to parse. Either failure to parse the lines, or failure to assemble the metrics.
Type
The possible types of Prometheus metrics.
ValueType
The possible types of a Value.

Functions§

parse_scrape
The standalone function to parse a text of a scrape into a Vec<Metric> and a set of errors. It is used by Scrape::parse to parse a scrape and error on the presence of any error. The stages: