Merge branch 'master' into worktree-agent-a720278a57ae41792
Claude-Session: https://claude.ai/code/session_01GT67AD99zQQqpLCVm3p7xk
This commit is contained in:
@@ -2,13 +2,35 @@ using ZB.MOM.WW.OtOpcUa.Commons.Types;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
||||
|
||||
/// <summary>One driver child's row in a <see cref="NodeDiagnosticsSnapshot"/>.</summary>
|
||||
/// <param name="DriverInstanceId">The driver instance's ConfigDb row id.</param>
|
||||
/// <param name="Name">The string driver-instance id (the identity every other surface keys on).</param>
|
||||
/// <param name="State">The child's last-published health state, or "Connecting" / "Stubbed".</param>
|
||||
/// <param name="ConnectedDevices">Hosts in <c>Running</c> (or 1 for a Healthy/Degraded single-host driver).</param>
|
||||
/// <param name="FaultedDevices">
|
||||
/// Hosts in <c>Faulted</c> only (or 1 for a Faulted single-host driver). Since #786 a <c>Stopped</c> host is
|
||||
/// NOT counted here — it is <paramref name="StoppedDevices"/>. A sender built before #786 still counts
|
||||
/// Stopped hosts in this figure.
|
||||
/// </param>
|
||||
/// <param name="LastChangeUtc">When the child last published a changed health snapshot (its spawn time until the first).</param>
|
||||
/// <param name="StoppedDevices">
|
||||
/// Hosts in <c>Stopped</c> (#786). Additive with a default so a snapshot from an older sender — which has no
|
||||
/// such member on the wire — still deserializes, reading 0.
|
||||
/// </param>
|
||||
/// <param name="FaultedHostNames">
|
||||
/// The <c>HostName</c>s of the hosts counted in <paramref name="FaultedDevices"/> (#786), so the AdminUI can
|
||||
/// count a device faulted on BOTH nodes of a redundant pair once. Empty for a single-host driver (the driver
|
||||
/// itself is the device); <see langword="null"/> from a sender built before #786.
|
||||
/// </param>
|
||||
public sealed record DriverInstanceDiagnostics(
|
||||
Guid DriverInstanceId,
|
||||
string Name,
|
||||
string State,
|
||||
int ConnectedDevices,
|
||||
int FaultedDevices,
|
||||
DateTime LastChangeUtc);
|
||||
DateTime LastChangeUtc,
|
||||
int StoppedDevices = 0,
|
||||
IReadOnlyList<string>? FaultedHostNames = null);
|
||||
|
||||
/// <summary>
|
||||
/// Per-node diagnostics returned by <c>IFleetDiagnosticsClient</c>. Populated by the node's
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// The <c>FailureReason</c> column bound shared by <c>Deployment</c> and <c>NodeDeploymentState</c>
|
||||
/// (<c>nvarchar(2048)</c>, <see cref="OtOpcUaConfigDbContext"/>). Every writer of either column goes through
|
||||
/// <see cref="Truncate"/>: a reason built from free text (an exception message, a node's reported reason) that
|
||||
/// overflows it makes SQL Server refuse the whole <c>SaveChanges</c>, and a write that can never succeed wedges
|
||||
/// whatever is retrying it (lmxopcua#868).
|
||||
/// </summary>
|
||||
public static class FailureReasons
|
||||
{
|
||||
/// <summary>The column's maximum length.</summary>
|
||||
public const int MaxLength = 2048;
|
||||
|
||||
/// <summary>Bounds a reason to <see cref="MaxLength"/> (ellipsis-terminated when cut); null stays null.</summary>
|
||||
/// <param name="reason">The reason, or null.</param>
|
||||
/// <returns>The reason, fitting the column.</returns>
|
||||
public static string? Truncate(string? reason) =>
|
||||
reason is null || reason.Length <= MaxLength ? reason : reason[..(MaxLength - 1)] + "…";
|
||||
}
|
||||
Reference in New Issue
Block a user