feat(reporter): add drift event and heal-attempt counters to state snapshot

This commit is contained in:
patrick committed 2026-03-05 21:28:25 -05:00
1 parent a2030a71b7
commit 8c7b0768b0
4 files changed
+29

No files matched your search

+9
View File
@@ -48,6 +48,7 @@ class LocalStateReporter:
last_heal_result=None,
last_heal_timestamp=None,
checks_increment=0,
drift_events_increment=0,
heal_result=None,
):
"""
@@ -71,11 +72,17 @@ class LocalStateReporter:
checks_total = max(0, self._get_int(previous, "checks_total", 0))
checks_total += max(0, int(checks_increment))
drift_events_total = max(0, self._get_int(previous, "drift_events_total", 0))
drift_events_total += max(0, int(drift_events_increment))
heals_total = max(0, self._get_int(previous, "heals_total", 0))
heal_failures_total = max(0, self._get_int(previous, "heal_failures_total", 0))
drift_heal_attempts_total = max(
0, self._get_int(previous, "drift_heal_attempts_total", 0)
)
if heal_result is not None:
heals_total += 1
drift_heal_attempts_total += 1
if heal_result != "success":
heal_failures_total += 1
@@ -95,6 +102,8 @@ class LocalStateReporter:
"last_heal_timestamp": effective_last_heal_timestamp,
"uptime_seconds": uptime_seconds,
"checks_total": checks_total,
"drift_events_total": drift_events_total,
"drift_heal_attempts_total": drift_heal_attempts_total,
"heals_total": heals_total,
"heal_failures_total": heal_failures_total,
}