M26: harden clean observability acceptance
MobilityOps acceptance / backend (push) Canceled after 0s
MobilityOps acceptance / frontend (push) Canceled after 0s

This commit is contained in:
NuklearRabbit
2026-08-10 16:15:23 +02:00
parent 90cc3cf378
commit b00d33af11
4 changed files with 30 additions and 7 deletions
+8 -2
View File
@@ -10,7 +10,7 @@ from sqlalchemy import func, select
from app.core.config import get_settings
from app.core.db import SessionLocal
from app.core.observability import OUTBOX_EVENTS
from app.models.outbox import DEMO_SCENARIO_ERROR_CODE, OutboxEvent
from app.models.outbox import DELIVERY_STATUSES, DEMO_SCENARIO_ERROR_CODE, OutboxEvent
router = APIRouter(tags=["observability"])
settings = get_settings()
@@ -26,8 +26,14 @@ def _refresh_database_metrics() -> None:
).group_by(OutboxEvent.delivery_status, "demo")
).all()
OUTBOX_EVENTS.clear()
# Keep every time series present even when a state currently contains no rows.
# Stable zero-valued series make dashboards and alerts deterministic after resets,
# restores and fresh installations instead of turning "zero" into "no data".
for scenario in ("synthetic", "operational"):
for status in DELIVERY_STATUSES:
OUTBOX_EVENTS.labels(scenario, status).set(0)
for status, is_demo, count in rows:
OUTBOX_EVENTS.labels(str(status), "synthetic" if is_demo else "operational").set(count)
OUTBOX_EVENTS.labels("synthetic" if is_demo else "operational", str(status)).set(count)
@router.get("/metrics", include_in_schema=False)