Skip to main content

Module metrics

Module metrics 

Source
Expand description

Structured, redacted observability hooks (RFC-024).

MetricsObserver is an optional, no-op-by-default trait for counters and outcome tracking. Implementations must never include plaintext secrets, lookup keys, subject IDs, or IP addresses in metric labels (RFC-024 §redaction).

The recommended metric names follow a codlet_<noun>_<verb>_total pattern (RFC-024 §metrics). High-cardinality labels (code IDs, user IDs, raw scopes) must not be used as metric dimensions.

§Usage

use codlet_core::metrics::{MetricsObserver, NoopMetrics, Outcome};

struct MyMetrics;
impl MetricsObserver for MyMetrics {
    fn increment(&self, counter: &'static str, outcome: Option<Outcome>) {
        // forward to your metrics backend (prometheus, statsd, …)
        let _ = (counter, outcome);
    }
}

Modules§

counter
Recommended counter names (RFC-024 §metrics).

Structs§

NoopMetrics
A no-op metrics observer. Compiles to nothing.

Enums§

Outcome
Outcome label for metrics that distinguish result categories.

Traits§

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