Update health endpoint with data-sources route
Browse files- backend/api/routes/health.py +10 -0
backend/api/routes/health.py
CHANGED
|
@@ -95,3 +95,13 @@ async def health_data(hub: DataHub = Depends(get_datahub)):
|
|
| 95 |
|
| 96 |
all_ok = all(s.get("ok", False) for s in sources.values())
|
| 97 |
return {"status": "ok" if all_ok else "degraded", "sources": sources}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
all_ok = all(s.get("ok", False) for s in sources.values())
|
| 97 |
return {"status": "ok" if all_ok else "degraded", "sources": sources}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
@router.get("/health/data-sources")
|
| 101 |
+
async def health_data_sources(hub: DataHub = Depends(get_datahub)):
|
| 102 |
+
"""Per-source data flow status with green/yellow/red classification."""
|
| 103 |
+
from backend.services.data_flow_monitor import DataFlowMonitor
|
| 104 |
+
|
| 105 |
+
loop = asyncio.get_event_loop()
|
| 106 |
+
monitor = DataFlowMonitor()
|
| 107 |
+
return await loop.run_in_executor(None, monitor.check_all, hub)
|