aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/stats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 06:53:00 +0100
committertv <tv@krebsco.de>2026-10-31 06:53:00 +0100
commit1cb2ef3f00e695a414de87acfec090dfde749934 (patch)
treebfb67dd536741f6d1e1c09a79c114953dc5c3530 /src/api/stats
parent88160e8aa273090c55103e7a92eeae9a8bdac9ed (diff)
add peer clock skew warning
Diffstat (limited to 'src/api/stats')
-rw-r--r--src/api/stats/prometheus.rs22
1 files changed, 22 insertions, 0 deletions
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(