diff --git a/archreview/plans/R2-10-resilience-observability-plan.md.tasks.json b/archreview/plans/R2-10-resilience-observability-plan.md.tasks.json index a3879c72..39fc2774 100644 --- a/archreview/plans/R2-10-resilience-observability-plan.md.tasks.json +++ b/archreview/plans/R2-10-resilience-observability-plan.md.tasks.json @@ -5,7 +5,7 @@ { "id": "T1", "subject": "Tracker: LastBreakerClosedUtc + IsBreakerOpen + RecordBreakerClose (Core, TDD in DriverResilienceStatusTrackerTests)", "status": "completed", "blockedBy": [] }, { "id": "T2", "subject": "Builder: OnClosed records breaker-close on the tracker (TDD in DriverResiliencePipelineBuilderTests)", "status": "completed", "blockedBy": ["T1"] }, { "id": "T3", "subject": "Invoker: successful Execute* resets ConsecutiveFailures (TDD in CapabilityInvokerTests)", "status": "completed", "blockedBy": ["T1"] }, - { "id": "T4", "subject": "Commons: DriverResilienceStatusChanged record + driver-resilience-status TopicName", "status": "pending", "blockedBy": [] }, + { "id": "T4", "subject": "Commons: DriverResilienceStatusChanged record + driver-resilience-status TopicName", "status": "completed", "blockedBy": [] }, { "id": "T5", "subject": "Host: DriverResilienceStatusPublisherService (BuildMessages mapping + 5s DPS timer shell; TDD mapping in Host.IntegrationTests)", "status": "pending", "blockedBy": ["T1", "T4"] }, { "id": "T6", "subject": "Host DI: register the publisher in AddOtOpcUaDriverFactories + ResilienceStatusReaderRegistrationTests wiring guard (tracker HAS a production reader)", "status": "pending", "blockedBy": ["T5"] }, { "id": "T7", "subject": "AdminUI: IDriverResilienceStatusStore + InMemory impl + AddOtOpcUaDriverStatusServices registration (TDD mirroring DriverStatusSnapshotStoreTests)", "status": "pending", "blockedBy": ["T4"] }, diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Commons/Messages/Drivers/DriverResilienceStatusChanged.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Commons/Messages/Drivers/DriverResilienceStatusChanged.cs new file mode 100644 index 00000000..b167dfe1 --- /dev/null +++ b/src/Core/ZB.MOM.WW.OtOpcUa.Commons/Messages/Drivers/DriverResilienceStatusChanged.cs @@ -0,0 +1,35 @@ +namespace ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers; + +/// +/// Snapshot of one driver instance's live resilience counters for a single target host, +/// published periodically to the driver-resilience-status DistributedPubSub topic by +/// DriverResilienceStatusPublisherService (Host, driver-role nodes) and consumed by the +/// AdminUI DriverResilienceStatusBridgeIDriverResilienceStatusStore → +/// resilience section of the driver status panel. Mirrors the +/// flow one-for-one; a separate topic keeps the two feeds (event-driven health vs. periodic +/// resilience) decoupled. +/// +/// Globally-unique driver instance ID (the panel filters on this alone). +/// Target host the counters aggregate for (per-device breaker isolation key). +/// Whether the circuit breaker is currently open for this (instance, host). +/// Consecutive pipeline failures — nonzero only during an active retry storm. +/// In-flight capability-call depth against this (instance, host). +/// UTC of the most recent breaker-open event; null if never. +/// UTC the tracker counters were last updated. +/// UTC this snapshot was published (drives staleness detection in the panel). +public sealed record DriverResilienceStatusChanged( + string DriverInstanceId, + string HostName, + bool BreakerOpen, + int ConsecutiveFailures, + int CurrentInFlight, + DateTime? LastBreakerOpenUtc, + DateTime LastSampledUtc, + DateTime PublishedUtc) +{ + /// + /// DPS topic name. Both the Host publisher and the AdminUI bridge reference this single + /// constant on the contract so a rename can't silently desynchronise publisher and subscriber. + /// + public const string TopicName = "driver-resilience-status"; +}