feat(health): wire up NodeHostname, ConnectionEndpoint, TagQuality, ParkedMessageCount collectors

- AkkaHostedService: SetNodeHostname from NodeOptions
- DataConnectionActor: UpdateConnectionEndpoint on state transitions,
  track per-tag quality counts and UpdateTagQuality on value changes
- HealthReportSender: query StoreAndForwardStorage for parked message count
- StoreAndForwardStorage: add GetParkedMessageCountAsync()
This commit is contained in:
Joseph Doherty
2026-03-23 10:57:57 -04:00
parent e84a831a02
commit 65cc7b69cd
5 changed files with 69 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using ScadaLink.Commons.Messages.Health;
using ScadaLink.StoreAndForward;
namespace ScadaLink.HealthMonitoring;
@@ -16,6 +17,7 @@ public class HealthReportSender : BackgroundService
private readonly HealthMonitoringOptions _options;
private readonly ILogger<HealthReportSender> _logger;
private readonly string _siteId;
private readonly StoreAndForwardStorage? _sfStorage;
private long _sequenceNumber;
public HealthReportSender(
@@ -23,13 +25,15 @@ public class HealthReportSender : BackgroundService
IHealthReportTransport transport,
IOptions<HealthMonitoringOptions> options,
ILogger<HealthReportSender> logger,
ISiteIdentityProvider siteIdentityProvider)
ISiteIdentityProvider siteIdentityProvider,
StoreAndForwardStorage? sfStorage = null)
{
_collector = collector;
_transport = transport;
_options = options.Value;
_logger = logger;
_siteId = siteIdentityProvider.SiteId;
_sfStorage = sfStorage;
}
/// <summary>
@@ -54,6 +58,16 @@ public class HealthReportSender : BackgroundService
if (!_collector.IsActiveNode)
continue;
if (_sfStorage != null)
{
try
{
var parkedCount = await _sfStorage.GetParkedMessageCountAsync();
_collector.SetParkedMessageCount(parkedCount);
}
catch { /* Non-fatal — parked count will be 0 */ }
}
var seq = Interlocked.Increment(ref _sequenceNumber);
var report = _collector.CollectReport(_siteId);

View File

@@ -16,6 +16,7 @@
<ItemGroup>
<ProjectReference Include="../ScadaLink.Commons/ScadaLink.Commons.csproj" />
<ProjectReference Include="../ScadaLink.StoreAndForward/ScadaLink.StoreAndForward.csproj" />
</ItemGroup>
<ItemGroup>