Module metrics

Source
Expand description

In-memory metrics counters and histograms.

Thread-safe via interior mutability. Renderable to Prometheus text format for the /metrics endpoint (Stage 7).

Structs§

Counter
Atomic-backed counter for cheap inc() from hot paths.
Gauge
Snapshot of a gauge.
Histogram
Histogram with exponential bucket boundaries.
Metrics
Standard metrics for agentguard.
MetricsSnapshot
Snapshot of all metrics, suitable for JSON serialization.

Constants§

DEFAULT_LABEL_CARDINALITY_CAP
Default cap on the number of distinct label-tuples retained for any one label-keyed metric. Prevents a misconfigured caller (or an attacker-controlled tenant_id) from growing the map without bound. When the cap is reached, new label-tuples are dropped and a warning is logged ONCE per metric.