Trait prometheus_client::encoding::EncodeMetric

source ·
pub trait EncodeMetric {
    // Required methods
    fn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>;
    fn metric_type(&self) -> MetricType;
}
Expand description

Trait implemented by each metric type, e.g. Counter, to implement its encoding in the OpenMetric text format.

Required Methods§

source

fn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>

Encode the given instance in the OpenMetrics text encoding.

source

fn metric_type(&self) -> MetricType

The OpenMetrics metric type of the instance.

Trait Implementations§

source§

impl EncodeMetric for Box<dyn EncodeMetric>

source§

fn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>

Encode the given instance in the OpenMetrics text encoding.
source§

fn metric_type(&self) -> MetricType

The OpenMetrics metric type of the instance.

Implementations on Foreign Types§

source§

impl EncodeMetric for Box<dyn EncodeMetric>

source§

fn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>

source§

fn metric_type(&self) -> MetricType

Implementors§