Přidal jsem Health Monitoring do portálu:

Přehled má nové karty: Zdravé služby, Nezdravé služby, Nedostupné služby.
Přehled zobrazuje sekci Služby vyžadující pozornost pro unhealthy a unreachable.
Snapshot /portal/ws/operations teď obsahuje health data a stránka je aktualizuje přes existující realtime vrstvu.
Seznam služeb zobrazuje aktuální health status a poslední kontrolu, včetně řazení Podle zdraví.
Detail služby má sekce Zdraví služby a Historie kontrol s posledními 50 záznamy.
Přidal jsem audit event service.health.view.
Browser title teď používá formát CSBot Services Portal - ..., takže detail služby odpovídá požadavku.
Nepoužil jsem ORM, vše je přes SQLite dotazy.
This commit is contained in:
JiriUhlir
2026-05-29 11:57:57 +02:00
parent 56f0b632de
commit ed194093e6
6 changed files with 303 additions and 3 deletions
+9
View File
@@ -1,4 +1,5 @@
from app.db.database import get_connection
from app.db.health import get_health_summary, get_problem_service_health
from app.db.migrations import run_migrations
from app.db.workers import is_worker_online
@@ -197,6 +198,8 @@ def get_operations_snapshot():
WHERE LOWER(COALESCE(status, '')) IN ('failed', 'error', 'disabled', 'deleted', 'archived')
"""
).fetchone()["count"]
health_summary = get_health_summary()
health_problems = get_problem_service_health()
jobs_summary = con.execute(
"""
@@ -296,6 +299,12 @@ def get_operations_snapshot():
"active": active_applications,
"problematic": problematic_applications,
},
"health": {
"healthy": health_summary["healthy"],
"unhealthy": health_summary["unhealthy"],
"unreachable": health_summary["unreachable"],
"problems": health_problems,
},
"workers": {
"online": workers_online,
"offline": max(0, total_workers - workers_online),