shoc-backend/docs/work-orders/phase-7/cloudwatch-alerts.md

1.4 KiB

Alertas Operacionais — Fase 7

Endpoint de saúde: GET /api/workorders/ops/health (Admin JWT)


Métricas expostas

Campo Fonte Uso
lastWeekRolledRunUtc WorkOrderJobRunState + ledger Job segunda-feira
lastPastDueCacheRunUtc WorkOrderJobRunState Cache opcional PastDue
syncRejectedLast24h WorkOrderAuditLogs Action=SyncRejected Conflito SHOC vs ingest
fieldLockCount WorkOrderFieldLocks Adoção edição manual
syncEnabled Sync:Enabled Estado ponte Dynamo
ingestEnabled WorkOrderIngest:Enabled Ingest direto ativo

Alertas recomendados (Elastic Beanstalk / CloudWatch)

Alerta Condição Severidade
WeekRolled stale lastWeekRolledRunUtc > 8 dias P1
WeekRolled job error lastWeekRolledError não nulo P1
SyncRejected spike syncRejectedLast24h > 50 P2
API 5xx board ALB/Beanstalk 5xx rate > 1% em /api/workorders/board P1
Ingest auth failures 401 em /api/workorders/ingest > 10/h P2
Sync disabled em prod sem cutover syncEnabled=false e ingest não validado P2

Verificação manual (ops)

# Com token Admin
curl -H "Authorization: Bearer <token>" https://<api-host>/api/workorders/ops/health

Agendar checagem diária durante piloto e rollout.