From 1cb2ef3f00e695a414de87acfec090dfde749934 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 06:53:00 +0100 Subject: add peer clock skew warning --- src/api/stats/prometheus.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/api/stats/prometheus.rs') diff --git a/src/api/stats/prometheus.rs b/src/api/stats/prometheus.rs index 2f33bef..6774e74 100644 --- a/src/api/stats/prometheus.rs +++ b/src/api/stats/prometheus.rs @@ -763,6 +763,28 @@ pub(super) fn render(stats: &StatsResponse, list: &PeerListResponse) -> String { propagation.ahead as f64, ); + let clock = &stats.clock; + out.single( + "clock_peers_compared", + "gauge", + "Active peers whose clocks were compared with ours (from their PONGs).", + clock.peers as f64, + ); + if let Some(offset_ms) = clock.offset_ms { + out.single( + "clock_offset_seconds", + "gauge", + "How far this node's clock is ahead of its peers' (behind: negative), the median.", + offset_ms as f64 / 1000.0, + ); + } + out.single( + "clock_off", + "gauge", + "1 while this node's clock differs from most of its peers' by more than --clock-skew-warn.", + flag(clock.off), + ); + // Node totals, including peers no longer listed. let totals = traffic_series(&stats.traffic); out.family( -- cgit v1.3.1