fix(hosts): driver health is per (driver, node) — ReportingNodeId on DriverHealthChanged + telemetry proto (#847)

This commit is contained in:
Joseph Doherty
2026-11-11 03:41:59 -05:00
parent 3b1b32f0c1
commit 038aa007ac
11 changed files with 150 additions and 21 deletions
@@ -58,6 +58,9 @@ public sealed record HostsDriverInstanceInfo(
/// when no instance matched. Fed to the row's expandable <c>DriverStatusPanel</c>. An
/// unmatched row defaults to enabled on purpose: the row only exists because a live snapshot arrived,
/// so telling the operator it is "not deployed" would contradict the evidence in front of them.</param>
/// <param name="NodeId">The cluster node that reported this snapshot (lmxopcua#847); null from a node that predates
/// the field. Both nodes of a redundant pair run the same driver instance, so the page shows one row per
/// (driver, node) — a driver Faulted on one node and Healthy on the other used to flip between the two.</param>
public sealed record HostsDriverRow(
string DriverInstanceId, string? Name, string? DriverType, string State,
DateTime? LastSuccessfulReadUtc, string? LastError, int ErrorCount5Min, DateTime PublishedUtc,
@@ -65,8 +68,12 @@ public sealed record HostsDriverRow(
IReadOnlyList<HostConnectivityStatus>? HostStatuses = null,
SkippedTagReport? SkippedTags = null,
bool Enabled = true,
IReadOnlyDictionary<string, string>? Diagnostics = null)
IReadOnlyDictionary<string, string>? Diagnostics = null,
string? NodeId = null)
{
/// <summary>The row's render key: unique per (driver instance, reporting node).</summary>
public string RowKey => $"{DriverInstanceId}@{NodeId}";
/// <summary>Diagnostics as ordered key/value pairs for rendering; empty when there are none, in which
/// case the page renders nothing.</summary>
public IReadOnlyList<KeyValuePair<string, string>> DiagnosticItems { get; } =
@@ -117,7 +124,8 @@ public sealed record HostsDriverRow(
/// </summary>
/// <param name="ClusterId">Cluster identifier.</param>
/// <param name="Nodes">Configured nodes in this cluster, ordered by node id.</param>
/// <param name="Drivers">Driver rows in this cluster, ordered by name then instance id.</param>
/// <param name="Drivers">Driver rows in this cluster — one per (driver instance, reporting node) — ordered by
/// name, then instance id, then node id.</param>
public sealed record HostsClusterGroup(string ClusterId, IReadOnlyList<HostsNodeInfo> Nodes, IReadOnlyList<HostsDriverRow> Drivers);
/// <summary>
@@ -188,10 +196,12 @@ public static class HostsDriverView
s.HostStatuses,
s.SkippedTags,
instance?.Enabled ?? true,
s.Diagnostics);
s.Diagnostics,
s.ReportingNodeId);
})
.OrderBy(d => d.Name ?? d.DriverInstanceId, StringComparer.OrdinalIgnoreCase)
.ThenBy(d => d.DriverInstanceId, StringComparer.OrdinalIgnoreCase)
.ThenBy(d => d.NodeId ?? "", StringComparer.OrdinalIgnoreCase)
.ToList();
groups.Add(new HostsClusterGroup(clusterId, clusterNodes, clusterDrivers));