iroh_metrics

Trait MetricsSource

Source
pub trait MetricsSource: Send + 'static {
    // Required method
    fn encode_openmetrics(&self, writer: &mut impl Write) -> Result<(), Error>;

    // Provided method
    fn encode_openmetrics_to_string(&self) -> Result<String, Error> { ... }
}
Expand description

Helper trait to abstract over different ways to access metrics.

Required Methods§

Source

fn encode_openmetrics(&self, writer: &mut impl Write) -> Result<(), Error>

Encodes all metrics into a string in the OpenMetrics text format.

This is expected to also write the terminal # EOF\n string expected by the OpenMetrics format.

Provided Methods§

Source

fn encode_openmetrics_to_string(&self) -> Result<String, Error>

Encodes the metrics in the OpenMetrics text format into a newly allocated string.

See also Self::encode_openmetrics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl MetricsSource for Arc<RwLock<Decoder>>

Source§

fn encode_openmetrics(&self, writer: &mut impl Write) -> Result<(), Error>

Source§

impl MetricsSource for Arc<Registry>

Source§

fn encode_openmetrics(&self, writer: &mut impl Write) -> Result<(), Error>

Implementors§