🚧 Add broker status page

This commit is contained in:
Jonas Bengtsson
2026-09-20 07:55:18 +02:00
parent 4322446fcf
commit 1e491642f1
9 changed files with 461 additions and 6 deletions
+14
View File
@@ -33,6 +33,7 @@ from app.models import (
from app.schemas import (
BrokerSettingsIn,
BrokerSettingsOut,
BrokerStatusOut,
ConfigPreviewOut,
DeployRequest,
ListenerIn,
@@ -316,6 +317,19 @@ def _publish_certificates(db: Session) -> None:
)
@router.get("/status", response_model=BrokerStatusOut)
def broker_status(_user: AnyReader):
"""Live $SYS telemetry for the dashboard (spec sections 33, 55).
Read-only: every management role may view (spec section 9). Fields
are None until the first $SYS publish arrives — the broker publishes
on sys_interval (10 s), so a fresh backend needs a few seconds.
"""
from app import metrics
return BrokerStatusOut(**metrics.snapshot())
@router.get("/config/preview", response_model=ConfigPreviewOut)
def preview_config(
db: Annotated[Session, Depends(get_db)], _user: AnyReader