metrics: optional OpenMetrics/Prometheus endpoint (metrics_bind, off by default) — commands/messages/connects counters bumped inline via shared atomics, users/channels/servers/links gauges republished each tick; no event round-trip on the hot path

This commit is contained in:
Jean Chevronnet 2026-08-18 22:34:36 +00:00
parent 30754f08b5
commit d4dadf33e6
6 changed files with 114 additions and 0 deletions

View file

@ -174,6 +174,8 @@ pub struct Server {
/// Module-owned server state, keyed by type. Each `modules/*.rs` stores its
/// own struct here so features live in their own file instead of this one.
pub ext: Extensible,
/// Prometheus counters/gauges, shared with the scrape thread (modules::metrics).
pub metrics: Arc<crate::modules::metrics::Metrics>,
}
impl Server {
@ -220,6 +222,7 @@ impl Server {
event_tx,
conn_counter,
ext: Extensible::default(),
metrics: crate::modules::metrics::handle(),
}
}