use std::fmt;
#[allow(missing_docs)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum MetricType {
Unknown,
Gauge,
Counter,
StateSet,
Info,
Histogram,
GaugeHistogram,
Summary,
}
impl MetricType {
pub fn as_str(&self) -> &'static str {
match self {
Self::Unknown => "unknown",
Self::Gauge => "gauge",
Self::Counter => "counter",
Self::StateSet => "stateset",
Self::Info => "info",
Self::Histogram => "histogram",
Self::GaugeHistogram => "gaugehistogram",
Self::Summary => "summary",
}
}
}
impl fmt::Display for MetricType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
pub trait TypedMetric {
const TYPE: MetricType;
}