Skip to content

Commit

Permalink
Return last_seen as an ISO timestamp in the heartbeat status endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 26, 2024
1 parent 0fe9836 commit d0d7174
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lvmbeat/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from lvmopstools.notifications import send_critical_error_email

from lvmbeat import __version__, config
from lvmbeat.tools import timestamp_to_iso


logger = logging.getLogger("uvicorn.error")
Expand Down Expand Up @@ -193,10 +194,12 @@ def route_get_heartbeat():
def route_get_heartbeat_status():
"""Status of the heartbeat monitor."""

state = app.state

return {
"enabled": app.state.enabled,
"active": app.state.active,
"last_seen": app.state.last_seen,
"enabled": state.enabled,
"active": state.active,
"last_seen": timestamp_to_iso(state.last_seen) if state.last_seen else None,
}


Expand Down

0 comments on commit d0d7174

Please sign in to comment.