From 1efe08483379f959ab69f6227c3ed130f54368b3 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 24 Nov 2026 08:02:41 -0500 Subject: [PATCH] docs(grpc-data): H4 remote history supported (SqlServer/QuestDB verified, Gateway pending #923), diagnostics and metrics, CLI projected-history note --- docs/Client.CLI.md | 18 ++++++++++++++++++ docs/DataConnections.md | 42 ++++++++++++++++++++++++++++++++++++++++- docs/Historian.md | 29 ++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/docs/Client.CLI.md b/docs/Client.CLI.md index 900b37d08..dcb617749 100644 --- a/docs/Client.CLI.md +++ b/docs/Client.CLI.md @@ -268,6 +268,24 @@ continuation points up to `--max`. `--events` cannot be combined with `--modifie | `--release-after-page` | With `--page-size`: send `releaseContinuationPoints` for page k's point and stop | | `--hold-seconds` | With `--abandon-after-page` / `--release-after-page`: keep the session open this long before disconnecting | +**Projected nodes (gRPC data connections).** A variable a data connection maps into this server lives in +`https://zb.com/otopcua/mapped/raw` or `…/mapped/uns` under an **opaque** `p1.` identifier. Never type or construct one: browse +from the mapping anchor (the local parent path plus the mapping's branch name) and pass the NodeId `browse` prints to `-n`. The +ids are stable across deploys, but a deploy retires a projected node the client has not browsed since — re-browse after a deploy +(and after the node has been idle past its metadata lease, #922), or the read answers `BadNodeIdUnknown` / `BadUserAccessDenied`. +History is served by the ORIGIN's historian, verbatim (values, statuses, timestamps, its paging); `--aggregate` is limited to what +the origin's backend serves (otherwise `BadAggregateNotSupported`), and `--modified` / `--events` are refused +`BadHistoryOperationUnsupported`. Verified with SqlServer and QuestDB origins; a Gateway (AVEVA) origin is unverified (#923). +The consumer's **Data connections** page shows the projected history counts and open continuations a read leaves behind +(`DataConnections.md` §"Remote history diagnostics and metrics"). + +```bash +# Resolve the projected NodeId by browsing from the anchor, then read it +otopcua-cli browse -u opc.tcp://localhost:4841/OtOpcUa -U apikey -P "$KEY" -n "" -r -d 3 +P='' +otopcua-cli historyread -u opc.tcp://localhost:4841/OtOpcUa -U apikey -P "$KEY" -n "$P" --max 100 +``` + The hand-paged modes exist for continuation-point lifecycle checks — most usefully on **projected** nodes of a gRPC data connection (`DataConnections.md` §"OPC UA HistoryRead on projected nodes"), where a resumed page is bound to the origin endpoint that issued it: pause after page 1, fail the origin over, create the resume file, and the resumed page prints diff --git a/docs/DataConnections.md b/docs/DataConnections.md index 18e1727f7..09c92c498 100644 --- a/docs/DataConnections.md +++ b/docs/DataConnections.md @@ -138,7 +138,10 @@ snapshot when a row carries a bit it does not know, taking down every connection `otopcua.dataconnection.unknown_operations_dropped` (tag `kind` = connection, export or mapping). - A drop is counted once per row per accepted artifact change. A → B → A counts again, and a restart resets the count. - - The dropped bits also show in the node's fleet diagnostics. + - The dropped bits also show in the node's fleet diagnostics and, since H4, on the cluster's + **Data connections** page (per connection, the count of mappings with drops, and per node the exports with + drops — named when the AdminUI knows the bit, hex otherwise, with a hint that the node's build is older + than the authored feature; #919). - Authoring rejects a bit until the release that implements it. H2 implements `HistoryRead`; the alarm bits stay rejected until A2. - The optional per-call header `x-otopcua-data-features` negotiates features. X0 parsed it and @@ -147,6 +150,11 @@ snapshot when a row carries a bit it does not know, taking down every connection ## Remote history (runtime consumers) +**Status: supported** (H4). Verified end to end (live gate H01–H06) with the origin on the **SqlServer** and **QuestDB** +historian backends. The **Gateway** backend (AVEVA Historian via HistorianGateway) is **unverified** pending its live leg, +#923 (blocked on the VPN to the historian) — the code path is the same origin history port, but no live read against it +has been run. + Since H2 a consumer can read the origin's history (HistoryRead Raw, Processed, AtTime) over a data connection. The origin serves it from its own historian backend (`ServerHistorian:Backend`) through the same pipeline its OPC UA clients use, so statuses (info bits included), timestamps and paging come back verbatim. H2 serves **runtime consumers** that hold the @@ -260,6 +268,38 @@ Modified-value reads (`IsReadModified`) and HistoryReadEvents on projected nodes `otopcua-cli historyread -n "" …`; `--page-size`, `--pause-after-page` and `--abandon-after-page` exercise the continuation lifecycle (`Client.CLI.md`). Live gate: `scripts/validation/grpc-data/history_gate.py` (H01–H06, README). +## Remote history diagnostics and metrics (H4) + +The cluster's **Data connections** page (`/clusters/{id}/data-connections`) shows, per consumer node and connection: + +- **Negotiated features** — what the last capability handshake negotiated for the data calls (`History`, or "none (v1 + behaviour)" against an origin without a historian backend or older than H2), and the **origin history** it advertised to this + caller: the variants (`raw`, `processed`, `attime`) and the aggregate count, or "not advertised". +- **Projected history reads** by status class (good / uncertain / bad) — one per projected node as answered to a local + OPC UA client, since process start (refusals before a node resolves to a connection are counted in the metric only). +- **Open remote continuations (local sessions)** — projected-history continuation points held in local OPC UA sessions: + issued, not yet resumed or released (a release, a session close or an eviction settles them). +- **Dropped unknown operation bits** — the X0 drops for that connection and how many of its mappings had bits dropped. + +And per node, under **Origin evidence by node**: whether the node serves remote history (has a historian backend), the live peer +history sessions, the **open origin continuations** (page cursors and chunk remainders held for peers), the history items it +answered by status class, and its exports with dropped unknown operation bits. + +All counts are since process start and reset on restart. "Unavailable" means the node did not report the measure (built +before H4, or no data-connection services) — never zero activity. + +Metrics, on the `ZB.MOM.WW.OtOpcUa` meter (exported on `/metrics` and OTLP like every OtOpcUa instrument), never carry a +connection, node or principal id in a label: + +| Instrument | Type | Labels | Meaning | +|---|---|---|---| +| `otopcua.dataconn.history.reads` | counter `{item}` | `variant` = raw \| processed \| attime, `status_class` = good \| uncertain \| bad, `side` = origin \| consumer | Origin: one per history item answered to a peer (refusals included). Consumer: one per projected node answered to a local OPC UA client. A node can be both, so `side` keeps them apart. | +| `otopcua.dataconn.history.continuations.active` | gauge `{continuation}` | `side` = origin \| consumer | Origin: cursors held for peers. Consumer: cursors held in local sessions. | +| `otopcua.dataconnection.unknown_operations_dropped` | counter `{row}` | `kind` = connection \| export \| mapping | The plan's `…operations.unknown_bits_dropped`: the X0 counter is reused rather than duplicated (see "Mixed versions"). | + +Before H4 the origin's `otopcua.dataconn.history.reads` sat on a private meter the host did not export; it is now on the +OtOpcUa meter and carries `side`. + ## Feature boundary Alarm/event forwarding and relay operations are future work; remote history is above. Authorized imported diff --git a/docs/Historian.md b/docs/Historian.md index 98896009e..c9a8f19fb 100644 --- a/docs/Historian.md +++ b/docs/Historian.md @@ -2625,6 +2625,35 @@ HistoryUpdate is gated in **both** ACL modes (rewriting recorded history was nev --- +## Remote history over data connections + +A node can serve its historian to other OtOpcUa clusters, and read theirs, over a gRPC **data connection** +(`docs/DataConnections.md`). Nothing in this section changes local HistoryRead; it describes the same historian seen +from a peer. + +- **Origin.** An export granting `HistoryRead` (bit 32) lets a peer principal HistoryRead (Raw, Processed, AtTime) the + exported historized nodes. The origin serves it through the same node-manager history port as local HistoryRead + (`IOriginHistoryPort`): the configured `ServerHistorian:Backend`, the same paging, bounds, aggregates and per-node + DataType rules, its own `MaxConcurrentHistoryReadBatches` limiter (remote reads hold at most N − max(1, N/4) slots), and + its own ACL `HistoryRead` check on every item. Denied, unhistorized and unknown nodes all answer + `BadHistoryOperationUnsupported`. The origin advertises only the aggregates its backend serves + (`IHistorianDataSource.SupportedAggregates`). HistoryUpdate, modified reads and event history are never served remotely. +- **Consumer.** A mapped (projected) variable is `Historizing` only when the mapping and the origin both grant it; an OPC UA + client of the consumer reads it like a local node, through opaque `p1.` NodeIds in `https://zb.com/otopcua/mapped/raw|uns` + that it resolves by browsing (`docs/Client.CLI.md`). The consumer has no historian of its own in this path: values, + statuses and continuation points come from the origin's backend verbatim. +- **Diagnostics and metrics (H4).** `otopcua.dataconn.history.reads{variant,status_class,side}` and + `otopcua.dataconn.history.continuations.active{side}`, plus per-connection and per-node evidence on the cluster's Data + connections page — `docs/DataConnections.md` §"Remote history diagnostics and metrics". + +**Verified backends.** Remote history is verified end to end (live gate H01–H06, `scripts/validation/grpc-data/history_gate.py`) +with the origin on **`SqlServer`** and **`QuestDb`**. The **`Gateway`** backend (AVEVA Historian via HistorianGateway) is +**unverified** remotely, pending its live leg (#923, blocked on the VPN to the historian). Nothing in the remote path is +backend-specific, but the Gateway's own differences (the four-plus-raw-evaluated aggregate set, the strict row ceiling, the +reverse-read walk-back) have not been observed through a data connection. + +--- + ## Authoring workflow 1. Open the equipment's **Tags** tab on `/uns/equipment/{id}`.