feat(audit,install): #1030 audit overflow drops exported as otopcua.audit.dropped; scripted SCM-restart-after-cluster-exit gate

- AuditWriterActor: every buffer-full drop is added to OtOpcUaTelemetry.AuditDropped
  (otopcua.audit.dropped{reason=buffer_full, actor}) — the count used to be readable only
  through the actor's own property.
- scripts/install/tests/Test-ScmRestartAfterClusterExit.Windows.ps1: the windev manual gate
  of 2026-12-03 as a script (qfailure restart action; failover/command trigger => non-zero exit,
  7031, Running under a new pid; Stop-Service stays stopped; optional kill control). Parse-checked
  with pwsh on macOS; must be run elevated on a Windows box hosting OtOpcUaHost.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-12-03 15:02:09 -05:00
parent 6b19f4add6
commit 2a8bac5bf5
7 changed files with 266 additions and 2 deletions
+1 -1
View File
@@ -435,7 +435,7 @@ per cluster at `/clusters/{id}/audit`. It has no `appsettings` section — it is
has a `ConfigDb` — but one schema property is worth recording here because it constrains how callers may
write to it:
*Flush behaviour (#980 / review 05 H-2):* `AuditWriterActor` batches events and flushes every 5 s (or at 500). A flush that fails because the database did not answer **keeps** the batch and retries on the next tick; the buffer is bounded at 10 000 events (drop-oldest, with `OverflowDroppedCount` and a Warning). Rows the database rejects outright (e.g. a duplicate `EventId`) are still dropped individually. Events are lost only if the actor stops while the database is still down (logged at Error with the count).
*Flush behaviour (#980 / review 05 H-2):* `AuditWriterActor` batches events and flushes every 5 s (or at 500). A flush that fails because the database did not answer **keeps** the batch and retries on the next tick; the buffer is bounded at 10 000 events (drop-oldest, with `OverflowDroppedCount` and a Warning; since #1030 every drop is also exported as the meter counter `otopcua.audit.dropped{reason=buffer_full}` on the `ZB.MOM.WW.OtOpcUa` meter — alert on any non-zero rate, it means `ConfigAuditLog` is missing rows). Rows the database rejects outright (e.g. a duplicate `EventId`) are still dropped individually. Events are lost only if the actor stops while the database is still down (logged at Error with the count).
- **`EventId` gives cross-restart deduplication, and the DB enforces it.** Each row carries the
stable per-event `AuditEvent.EventId`, under a *filtered* unique index