Skip to main content

MetricsObserver

Trait MetricsObserver 

Source
pub trait MetricsObserver {
    // Required method
    fn increment(&self, counter: &'static str, outcome: Option<Outcome>);
}
Expand description

Optional observability sink for metrics and counters (RFC-024).

All implementations must be no-op by default (see NoopMetrics). Implementations must not include high-cardinality or sensitive values in metric labels — no code IDs, subject IDs, IP addresses, lookup keys, or raw scopes.

Required Methods§

Source

fn increment(&self, counter: &'static str, outcome: Option<Outcome>)

Increment counter by 1, optionally tagging with outcome.

Counter names should come from the counter module constants. This method is called in hot paths; it must not block.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§