Skip to main content

MetricEmitter

Trait MetricEmitter 

Source
pub trait MetricEmitter {
    // Required methods
    fn record_counter(
        &mut self,
        instrument: &'static str,
        value: u64,
        unit: Option<&'static str>,
    );
    fn record_gauge_u64(
        &mut self,
        instrument: &'static str,
        value: u64,
        unit: Option<&'static str>,
    );
    fn record_gauge_f64(
        &mut self,
        instrument: &'static str,
        value: f64,
        unit: Option<&'static str>,
    );
    fn record_histogram(
        &mut self,
        instrument: &'static str,
        value: f64,
        unit: Option<&'static str>,
        bounds: &'static [f64],
    );
    fn with_attributes(&mut self, attrs: &[(&'static str, &str)]);
}
Expand description

Implemented by metric sinks (OTLP metrics, Prometheus exporters). Generated EventSchema::project_metrics calls one method per MEASUREMENT field. Spec 12 § 3.6.

Required Methods§

Source

fn record_counter( &mut self, instrument: &'static str, value: u64, unit: Option<&'static str>, )

Record a counter increment.

Source

fn record_gauge_u64( &mut self, instrument: &'static str, value: u64, unit: Option<&'static str>, )

Record a u64 gauge value.

Source

fn record_gauge_f64( &mut self, instrument: &'static str, value: f64, unit: Option<&'static str>, )

Record an f64 gauge value.

Source

fn record_histogram( &mut self, instrument: &'static str, value: f64, unit: Option<&'static str>, bounds: &'static [f64], )

Record a histogram observation against the supplied bounds.

Source

fn with_attributes(&mut self, attrs: &[(&'static str, &str)])

Attribute set carried into every record_* on the same event.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§