fix(historian-gateway): alarm SendEvent must not set wire event Id (live-validated)
v2-ci / build (pull_request) Failing after 45s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (pull_request) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (pull_request) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (pull_request) Has been skipped
v2-ci / build (pull_request) Failing after 45s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (pull_request) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (pull_request) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (pull_request) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (pull_request) Has been skipped
Live validation against wonder-sql-vd03 caught that the gateway's SendEvent handler throws when the wire event carries a client-supplied Id — so every alarm send from OtOpcUa failed (PermanentFail). AlarmEventMapper now leaves HistorianEvent.Id unset (the historian assigns event identity) and preserves the alarm's id as an 'AlarmId' property. With this, the live alarm send acks. Also harden the env-gated live tests against two gateway/historian-side limitations surfaced during validation (neither an OtOpcUa defect): the write readback uses a timezone-tolerant window (an explicit-timestamp WriteLiveValues lands offset by the deployment's local-vs-UTC delta — reproducible via raw grpcurl; OtOpcUa sends correct UTC), and the alarm ReadEvents readback skips with a clear reason when the historian's server-gated event reads (C2, won't-fix) return nothing. Read + write-persist + alarm-send are all live-validated green; the alarm send-ack is split into its own test. Claude-Session: https://claude.ai/code/session_012SDSQ3AcaXqPcBtDESBRii
This commit is contained in:
@@ -21,7 +21,10 @@ internal static class AlarmEventMapper
|
||||
|
||||
var historianEvent = new HistorianEvent
|
||||
{
|
||||
Id = string.IsNullOrWhiteSpace(alarm.AlarmId) ? Guid.NewGuid().ToString("N") : alarm.AlarmId,
|
||||
// Deliberately DO NOT set HistorianEvent.Id: the gateway's SendEvent path rejects a
|
||||
// client-supplied event id (the server handler throws and the call fails permanently —
|
||||
// confirmed live). The historian assigns event identity server-side; the alarm's own id
|
||||
// is preserved below as a property for read-back correlation/traceability.
|
||||
SourceName = alarm.EquipmentPath,
|
||||
Type = alarm.AlarmTypeName,
|
||||
EventTime = eventTime,
|
||||
@@ -29,6 +32,8 @@ internal static class AlarmEventMapper
|
||||
};
|
||||
|
||||
// Proto map<string,string> values must be non-null — only insert non-null properties.
|
||||
if (!string.IsNullOrWhiteSpace(alarm.AlarmId))
|
||||
historianEvent.Properties["AlarmId"] = alarm.AlarmId;
|
||||
historianEvent.Properties["AlarmName"] = alarm.AlarmName;
|
||||
historianEvent.Properties["EventKind"] = alarm.EventKind;
|
||||
historianEvent.Properties["Severity"] = alarm.Severity.ToString();
|
||||
|
||||
Reference in New Issue
Block a user