fix(reporter): emit UTC-aware timestamps for state and heal history
This commit is contained in:
1 parent
ecda631049
commit
1013b05790
1 file changed
+4
-4
+4
-4
@@ -4,7 +4,7 @@ import json
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
class LocalStateReporter:
|
||||
"""
|
||||
@@ -140,7 +140,7 @@ class LocalStateReporter:
|
||||
effective_last_heal_timestamp = (
|
||||
last_heal_timestamp
|
||||
if last_heal_timestamp is not None
|
||||
else datetime.now().isoformat()
|
||||
else datetime.now(timezone.utc).isoformat()
|
||||
)
|
||||
|
||||
now_epoch = time.time()
|
||||
@@ -176,7 +176,7 @@ class LocalStateReporter:
|
||||
uptime_seconds = max(0, int(now_epoch - self.started_at_epoch))
|
||||
status_data = {
|
||||
"node_name": self.node_name,
|
||||
"last_check": datetime.now().isoformat(),
|
||||
"last_check": datetime.now(timezone.utc).isoformat(),
|
||||
"status": "HEALTHY" if is_synced else "DESYNC_DETECTED",
|
||||
"is_synced": is_synced,
|
||||
"kernel_ban_count": ban_count,
|
||||
@@ -228,7 +228,7 @@ class LocalStateReporter:
|
||||
Records a specific healing event in a persistent history log.
|
||||
"""
|
||||
history_file = self.get_history_file()
|
||||
timestamp = datetime.now().isoformat()
|
||||
timestamp = datetime.now(timezone.utc).isoformat()
|
||||
|
||||
try:
|
||||
with open(history_file, 'a') as f:
|
||||
|
||||
Reference in new issue
Block a user