🚧 Add broker status page
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user