#[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.
Trait Implementations§
impl Copy for Format
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnwindSafe for Format
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)