refactor(health): move ISiteHealthCollector to Commons; Communication drops HealthMonitoring reference (ScadaBridge#87)

Interface now lives in Commons.Interfaces.Services; AuditLog no longer gets it
transitively through Communication. Implementation stays in HealthMonitoring.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 13:11:22 -05:00
parent e5ad4c9f53
commit c4186509f6
55 changed files with 60 additions and 12 deletions
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Akka.Actor;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.Extensions.DependencyInjection;
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Akka.Actor;
using Akka.Cluster;
using Microsoft.Extensions.DependencyInjection;
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Akka.Actor;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.Extensions.DependencyInjection;
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Akka.Actor;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.Extensions.DependencyInjection;
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Health;
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
@@ -102,14 +103,14 @@ public static class ServiceCollectionExtensions
// Registered via factory-lambda so ISiteHealthCollector (registered by the
// Host's AddSiteHealthMonitoring) is resolved lazily at host start.
services.AddHostedService(sp => new ScriptSchedulerStatsReporter(
sp.GetRequiredService<HealthMonitoring.ISiteHealthCollector>(),
sp.GetRequiredService<Commons.Interfaces.Services.ISiteHealthCollector>(),
sp.GetRequiredService<IOptions<SiteRuntimeOptions>>().Value,
sp.GetRequiredService<ILogger<ScriptSchedulerStatsReporter>>()));
// Periodically lift SiteStreamManager's alarm-publish-queue drop count
// onto the site health report.
services.AddHostedService(sp => new Streaming.SiteStreamAlarmDropReporter(
sp.GetRequiredService<HealthMonitoring.ISiteHealthCollector>(),
sp.GetRequiredService<Commons.Interfaces.Services.ISiteHealthCollector>(),
sp.GetRequiredService<SiteStreamManager>(),
sp.GetRequiredService<ILogger<Streaming.SiteStreamAlarmDropReporter>>()));
@@ -143,7 +144,7 @@ public static class ServiceCollectionExtensions
// Forward every node's replicated secret_mirror_status row onto the
// site health report, so the ACTIVE node's report carries the STANDBY's mirror failures.
services.AddHostedService(sp => new SecretMirrorStatusReporter(
sp.GetRequiredService<HealthMonitoring.ISiteHealthCollector>(),
sp.GetRequiredService<Commons.Interfaces.Services.ISiteHealthCollector>(),
sp.GetRequiredService<SiteStorageService>(),
sp.GetRequiredService<ILogger<SecretMirrorStatusReporter>>(),
staleAfter: sp.GetRequiredService<IOptions<SiteRuntimeOptions>>().Value.SecretMirrorStatusStaleAfter,
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime;
/// <summary>
@@ -1,3 +1,4 @@
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ZB.MOM.WW.ScadaBridge.HealthMonitoring;