fix(grpc-data): A4 review r1 — AdminUI helpers null-safe + doc comments restored; metric descriptions name both sides; docs: S1/S2/S3 behaviour, RefreshRequired only on a changed incomplete set, SourceName vs runtime status (S4), scripted Good = applied, A4-docs citations

This commit is contained in:
Joseph Doherty
2026-11-25 00:22:54 -05:00
parent c93290d0a0
commit 0cac09cee3
8 changed files with 60 additions and 19 deletions
+17 -3
View File
@@ -416,9 +416,15 @@ refresh, EventIds) is documented in [Alarm tracking § Imported conditions](Alar
- Retry delay, per mapping. A **definitive** refusal (`Denied`, `NotFound` or `Unsupported`, for the item or the root
metadata) or `ConditionCapacity` waits `LongRetryDelay` (5 min) × 2ⁿ, capped at 4× (20 min). Any other refusal or a
snapshot timeout waits `ConditionSnapshotTimeoutMilliseconds` × 2ⁿ, capped at 8×. A retry whose snapshot has not
completed by its deadline goes back to `Unavailable` and releases its claim; a late completion is still taken. A
completed by its deadline goes back to `Unavailable` but keeps its buffer and claim, exactly like a mapping that missed
the first barrier: a late completion is still swapped in, until the next retry removes that item and starts over. A
completed snapshot resets the count. While a retry runs the mapping is `Pending` (unknown), so nothing it might list is
removed or marked known-inactive (T2).
- Every command on the stream has a unique id (the transport refuses a reused one and the stream would end).
- An item ack that arrives after its retry was already replaced (a slow origin) is not ignored: a Good one means the
origin opened an item the consumer no longer tracks, so it is removed at once — otherwise every later re-add would be
refused `InvalidArgument` ("Duplicate client item id"). As a backstop, 3 consecutive `InvalidArgument` refusals of a
mapping's in-stream re-adds end the stream (a new stream clears the origin's items).
- `ConditionCapacity` therefore recovers in-stream: after the origin's listing shrinks (or the limit is raised) the next
retry's snapshot is admitted and swapped in.
- `RefreshRequired` is sent at an incomplete barrier only when its set of incomplete mappings differs from the previous
@@ -558,7 +564,15 @@ most clients read an Uncertain status as success.
Two charges are made against the host caps: a snapshotting mapping is charged its admitted `total`, and a completed mapping
its record count. Growth is charged as it happens. Records beyond `total`, live records beyond `MaxConditions`, or growth past
a host cap make that mapping `ConditionCapacity`. Its item is removed, its conditions are removed (except keys another
mapping lists) and clients get `RefreshRequired`. The deploy gate also logs a non-blocking `DataConditionCapacityWarning`
mapping lists) and clients get `RefreshRequired`.
Held keys that no contributing mapping lists (an `Unavailable` mapping's stale conditions, kept as `BadNoCommunication`)
are charged too, beside every new claim. The one allowance: a mapping with no complete set yet on this stream may be
re-listing keys **it** listed when it was last known, so those held keys are not charged twice. A mapping that never listed
them gets no allowance, so another mapping's held keys cannot make room for it. The remaining overshoot is narrow: a mapping
whose origin retired its old keys and lists new ones, while another mapping is unknown so the old ones stay held, can
exceed the caps by at most its own previous count until that mapping is known. It is logged ("over its host condition
caps") and visible as the node budget line in the AdminUI. The deploy gate also logs a non-blocking `DataConditionCapacityWarning`
when Σ `MaxConditions` × 49 of a consumer node's mappings exceeds `MaxImportedConditionNodes`.
### Diagnostics and troubleshooting
@@ -569,7 +583,7 @@ ones carry `side` = origin | consumer, because a node can be both:
| Instrument | Type | Labels | Meaning |
|---|---|---|---|
| `otopcua.dataconn.conditions.items` | up/down counter `{item}` | `side` | Origin: root-scoped condition items open for peers. Consumer: the items its condition streams hold open (one per acked mapping item). |
| `otopcua.dataconn.conditions.resyncs` | counter `{resync}` | `side` | Origin: an item re-snapshotted after a hub reader reset. Consumer: a condition stream that ended (the next one re-snapshots). |
| `otopcua.dataconn.conditions.resyncs` | counter `{resync}` | `side` | Origin: an item re-snapshotted after a hub reader reset. Consumer: a condition stream that opened and ended (the next one re-snapshots); a connect attempt that never opened a stream is not counted. |
| `otopcua.dataconn.conditions.capacity_rejections` | counter `{item}` | `side` | Origin: an item snapshot over its `MaxConditions` (or refused by the snapshot memory budget). Consumer: a mapping reset to `ConditionCapacity` (over its `MaxConditions` or the host caps). |
| `otopcua.dataconn.condition_methods` | counter `{call}` | `method`, `outcome` (the `DataWriteState`), `side` | Origin: calls served. Consumer: calls forwarded (a call the local node manager refuses before forwarding is not counted). |
| `otopcua.dataconn.conditions.refresh_required` | counter `{request}` | `side` = consumer | RefreshRequired requests the consumer runtime made: an incomplete barrier with a changed incomplete set, a capacity reset that removed nothing, each removal batch. Not per client item. |