Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def _record_chat_turn_telemetry(
try:
get_store().record_chat_turn_stat(
conversation_id=conversation_id,
recorded_at=_utc_now(),
recorded_at=utc_now_iso(),
backend=backend,
agent_id=agent_id,
model_name=model_name,
Expand Down Expand Up @@ -442,10 +442,6 @@ def _read_addon_version() -> str:
_HA_INTEGRATIONS_URL = "/config/integrations/dashboard"


def _utc_now() -> str:
return utc_now_iso()


def _tail_log(n: int = 80) -> list[str]:
if not LOG_PATH.exists():
return []
Expand Down Expand Up @@ -855,14 +851,15 @@ def chat_transcript(conversation_id: str) -> dict[str, object]:

@app.get("/health")
def health() -> dict[str, str]:
return {"status": "ok", "service": "core", "checked_at": _utc_now()}
return {"status": "ok", "service": "core", "checked_at": utc_now_iso()}

@app.get("/v1/health/snapshot")
def health_snapshot() -> dict[str, object]:
try:
return build_health_snapshot()
except Exception as exc: # noqa: BLE001
return {"error": str(exc), "computed_at": _utc_now()}
log.exception("health_snapshot failed")
return {"error": "health snapshot unavailable", "computed_at": utc_now_iso()}

@app.get("/v1/issues/active")
def list_active_issues() -> dict[str, object]:
Expand All @@ -878,20 +875,32 @@ def list_active_issues() -> dict[str, object]:
"issues": [],
"status": "placeholder",
"note": ISSUES_PAUSED_NOTE,
"computed_at": _utc_now(),
"computed_at": utc_now_iso(),
}
try:
issues = get_store().list_active_issues()
return {"count": len(issues), "issues": issues, "computed_at": _utc_now()}
return {"count": len(issues), "issues": issues, "computed_at": utc_now_iso()}
except Exception as exc: # noqa: BLE001
return {"count": 0, "issues": [], "error": str(exc), "computed_at": _utc_now()}
log.exception("list_active_issues failed")
return {
"count": 0,
"issues": [],
"error": "active issues unavailable",
"computed_at": utc_now_iso(),
}

@app.get("/v1/topology")
def topology_snapshot(include_phantoms: bool = False) -> dict[str, object]:
try:
return topology_mod.build_topology(include_phantoms=include_phantoms)
except Exception as exc: # noqa: BLE001
return {"nodes": [], "links": [], "error": str(exc), "computed_at": _utc_now()}
log.exception("topology_snapshot failed")
return {
"nodes": [],
"links": [],
"error": "topology unavailable",
"computed_at": utc_now_iso(),
}

@app.get("/v1/topology/history")
def topology_history(limit: int = 20) -> dict[str, object]:
Expand Down Expand Up @@ -1217,7 +1226,7 @@ async def dev_status(include_phantoms: bool = False) -> dict[str, object]:
)
return {
"addon_version": ADDON_VERSION,
"checked_at": _utc_now(),
"checked_at": utc_now_iso(),
"supervisor": sup,
"health": health,
"issues": list_active_issues(),
Expand Down
Loading