#[non_exhaustive]pub enum Format {
OpenMetrics,
Prometheus,
OpenMetricsForPrometheus,
}Expand description
Metrics export format.
Supported formats are quite similar, but differ how they encode counter values and whether
they specify the # EOF terminator:
| Format | _total suffix for counters | _info suffix for info | # EOF |
|---|---|---|---|
Self::OpenMetrics | yes | yes | yes |
Self::OpenMetricsForPrometheus | no | no | yes |
Self::Prometheus | no | no | no |
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
OpenMetrics
OpenMetrics text format. This is the original format produced by prometheus-client, which
this library is based upon.
Prometheus
Prometheus text format. Since it’s quite similar to the OpenMetrics format, it’s obtained by
a streaming transform of OpenMetrics-encoded metrics that removes _total suffixes from
reported counter values, _info suffixes from reported info values + changes info types to “gauge”,
and removes the # EOF terminator.
OpenMetricsForPrometheus
OpenMetrics text format as understood by Prometheus.
Prometheus mostly understands the OpenMetrics format (e.g., enforcing no empty lines for it).
The notable exception is counter and info definitions; OpenMetrics requires
to append _total to the counter name and _info to the info name (like _sum / _count / _bucket are appended
to histogram names), but Prometheus doesn’t understand this (yet?).
See also: issue in prometheus-client
Implementations§
Source§impl Format
impl Format
Sourcepub const OPEN_METRICS_CONTENT_TYPE: &'static str = "application/openmetrics-text; version=1.0.0; charset=utf-8"
pub const OPEN_METRICS_CONTENT_TYPE: &'static str = "application/openmetrics-text; version=1.0.0; charset=utf-8"
Content type for OpenMetrics text format.
Sourcepub const PROMETHEUS_CONTENT_TYPE: &'static str = "text/plain; version=0.0.4; charset=utf-8"
pub const PROMETHEUS_CONTENT_TYPE: &'static str = "text/plain; version=0.0.4; charset=utf-8"
Content type for Prometheus test format.