From dcb0be650ebce45e244e15de01ab1de08bbb3a57 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 15 Jun 2026 01:30:15 -0400 Subject: [PATCH] feat(galaxy): debug-log native alarm feed delivery (subs + fanout) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native-alarm delivery through OnAlarmFeedTransition was a black box — there was no way to answer 'is the gateway feed delivering / is a subscription un-gating it', which is partly why the missing-SubscribeAlarmsAsync wiring shipped undetected. Add a single per-transition Debug line (kind, ref, live subscription count, fanout flag). Debug so a flapping galaxy doesn't flood prod, but available on demand. --- .../GalaxyDriver.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy/GalaxyDriver.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy/GalaxyDriver.cs index 2cc822b6..d5ea6e49 100644 --- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy/GalaxyDriver.cs +++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy/GalaxyDriver.cs @@ -1128,6 +1128,7 @@ public sealed class GalaxyDriver private void OnAlarmFeedTransition(object? sender, GalaxyAlarmTransition transition) { GalaxyAlarmSubscriptionHandle? handle; + int subCount; lock (_alarmHandlersLock) { // Pick the earliest-registered handle as the event owner. The server routes @@ -1137,10 +1138,17 @@ public sealed class GalaxyDriver // subscription remains — HashSet.First() was unstable across mutations // (Driver.Galaxy-006 fix). _alarmSubscriptions is a List, so [0] is always // the earliest-registered handle. - handle = _alarmSubscriptions.Count > 0 - ? _alarmSubscriptions[0] - : null; + subCount = _alarmSubscriptions.Count; + handle = subCount > 0 ? _alarmSubscriptions[0] : null; } + // Native-alarm delivery observability (was a black box): one line per feed transition with the + // resolved alarm ref, the live subscription count, and whether it fans out to OnAlarmEvent. Debug + // so a flapping galaxy doesn't flood prod, but available on demand to answer "is the feed + // delivering / is the subscription un-gating it" — the exact question this driver couldn't answer + // before the SubscribeAlarmsAsync wiring fix. + _logger.LogDebug( + "GalaxyDriver alarm feed: {Kind} {Ref} (subs={Subs}, fanout={Fanout})", + transition.TransitionKind, transition.AlarmFullReference, subCount, handle is not null); if (handle is null) return; var args = new AlarmEventArgs(