78eb98ea13
#930 N2: an Unavailable mapping (refused item, failed root, snapshot timeout) is retried on the OPEN stream by re-adding its item (AddSubscriptionItems) on its own backoff — definitive refusals (Denied/NotFound/Unsupported) on LongRetryDelay (5 min, doubling to 4x), transient ones on the snapshot timeout x 2^n (<= 8x) — so healthy mappings are never re-snapshotted for it; an incomplete barrier whose incomplete set equals the previous barrier's sends no RefreshRequired. N3: ConditionCapacity is retried in-stream on the long timer and recovers. #931 N4 exponential reconnect backoff (MaxReconnectDelay 60 s); N5 held-but-unlisted keys charged beside known claims (overlapping unknown ones) + SetMaterialised cap report; N6 method calls read Serving without _gate; N7 a capacity reset that removed conditions sends no second RefreshRequired; N8 a parked runner is released once its removal finished. A4 diagnostics core: DataConnectionConditionDiagnostics (side-labelled items/resyncs/capacity/method metrics, new refresh_required counter, consumer + origin evidence), Commons contracts, DI + deployment-runtime + driver-host wiring. Co-Authored-By: Claude <noreply@anthropic.com>
108 lines
7.3 KiB
C#
108 lines
7.3 KiB
C#
using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
|
|
|
/// <summary>Bounded, secret-free evidence from one node's applied data connection.</summary>
|
|
/// <remarks>Nullable measures mean that evidence is unavailable, rather than zero activity.</remarks>
|
|
public sealed record DataConnectionDiagnosticsSnapshot(
|
|
string ConnectionId,
|
|
long Revision,
|
|
string State,
|
|
string? SelectedEndpoint,
|
|
ServingIdentity? Serving,
|
|
int ActiveStreams,
|
|
int ActiveCalls,
|
|
long ScopeVersion,
|
|
string ArtifactRevision,
|
|
DateTime AsOfUtc,
|
|
DateTime? LastSampleAtUtc = null,
|
|
DateTime? MetadataLeaseExpiresAtUtc = null,
|
|
int? SourceCount = null,
|
|
int? RegistrationCount = null,
|
|
long? ResetCount = null,
|
|
long? OverflowCount = null,
|
|
long? WriteSucceededCount = null,
|
|
long? WriteRejectedCount = null,
|
|
long? WriteUnknownCount = null,
|
|
int? ProtocolMajor = null,
|
|
int? ProtocolMinor = null,
|
|
DateTime? LastVerifiedAtUtc = null,
|
|
long? WriteFailedCount = null,
|
|
long? WriteUnconfirmedCount = null,
|
|
TimeSpan? SampleAgeUpperBound = null,
|
|
long? CoalescedCount = null,
|
|
long? CompactFrameCount = null,
|
|
long? FallbackFrameCount = null,
|
|
long? SerializedValueFrameBytes = null,
|
|
string? AccountingInstanceId = null,
|
|
// X0 tolerant reader: operation bits this connection row was authored with that this node does not implement and
|
|
// dropped (None = nothing dropped; null = from an older sender), and how many of its mappings had bits dropped.
|
|
DataOperations? DroppedUnknownOperations = null,
|
|
int? MappingsWithDroppedOperations = null,
|
|
// H4 consumer-side history evidence: the features the last capability handshake negotiated (None = v1 behaviour), the
|
|
// history variants and aggregate count the origin advertised to this caller, projected HistoryRead results by status
|
|
// class (per node, as answered to local OPC UA clients) and the remote continuations held in local sessions.
|
|
DataFeatures? NegotiatedFeatures = null,
|
|
IReadOnlyList<string>? HistoryVariants = null,
|
|
int? HistoryAggregateCount = null,
|
|
long? HistoryReadsGood = null,
|
|
long? HistoryReadsUncertain = null,
|
|
long? HistoryReadsBad = null,
|
|
int? OpenRemoteContinuations = null,
|
|
// A4 consumer-side imported-condition evidence (null = no condition-bearing mapping on this connection, or an older sender).
|
|
ConsumerConditionDiagnostics? Conditions = null);
|
|
|
|
/// <summary>A4: one condition-bearing mapping of a consumer connection's condition stream.</summary>
|
|
/// <param name="MappingId">The mapping.</param>
|
|
/// <param name="Status">Pending | Snapshotting | Complete | Unavailable | ConditionCapacity.</param>
|
|
/// <param name="Observed">The last count the origin reported or listed for it (a snapshot total, or the committed set).</param>
|
|
/// <param name="Limit">The mapping's <c>MaxConditions</c>.</param>
|
|
/// <param name="Refusal">The origin's last refusal status for its item or root (null when not refused).</param>
|
|
public sealed record ConditionMappingDiagnostics(string MappingId, string Status, int Observed, int Limit, string? Refusal = null);
|
|
|
|
/// <summary>A4: consumer evidence of one connection's imported conditions (plan §6 "AdminUI").</summary>
|
|
/// <param name="StreamState">idle (no event subscriber) | connecting | snapshotting | live.</param>
|
|
/// <param name="SnapshotAtUtc">When the connection's last snapshot barrier passed (null: none since start).</param>
|
|
/// <param name="Materialised">Imported conditions this node holds for the connection.</param>
|
|
/// <param name="StateUnknown">Of those, how many carry <c>state_known = false</c> (never shown known-inactive).</param>
|
|
/// <param name="RefreshRequired">RefreshRequired requests made for the connection since start (explicit, plus each removal batch).</param>
|
|
/// <param name="Resyncs">Condition streams that ended and re-snapshotted since start.</param>
|
|
/// <param name="CapacityRejections">Mappings reset to ConditionCapacity since start.</param>
|
|
/// <param name="Mappings">Per mapping: status, observed count vs limit, refusal.</param>
|
|
/// <param name="ChargedConditions">Imported conditions charged against this node's host caps (every connection).</param>
|
|
/// <param name="HostConditionLimit">The node-wide condition cap implied by <c>MaxImportedConditionNodes</c>/<c>Bytes</c>.</param>
|
|
public sealed record ConsumerConditionDiagnostics(string StreamState, DateTime? SnapshotAtUtc, int Materialised, int StateUnknown,
|
|
long RefreshRequired, long Resyncs, long CapacityRejections, IReadOnlyList<ConditionMappingDiagnostics> Mappings,
|
|
long ChargedConditions, long HostConditionLimit, ConditionMethodCounts Methods);
|
|
|
|
/// <summary>A4: remote condition method calls by outcome class (from <c>DataWriteState</c>).</summary>
|
|
public sealed record ConditionMethodCounts(long Succeeded, long Rejected, long Failed, long Unknown);
|
|
|
|
/// <summary>A4: origin-side evidence of the root-scoped condition items this node serves to peers.</summary>
|
|
/// <param name="OpenItems">Open condition items (all peers).</param>
|
|
/// <param name="LargestListing">The largest current listing among the open items (their last snapshot's total).</param>
|
|
/// <param name="ListingLimit">That item's <c>MaxConditions</c> limit (0 when no item is open).</param>
|
|
/// <param name="LastSnapshotAtUtc">When an item last took a snapshot (null: none since start).</param>
|
|
/// <param name="Resyncs">Items re-snapshotted after a hub reader reset since start.</param>
|
|
/// <param name="CapacityRejections">Item snapshots refused as over the item's limit since start.</param>
|
|
/// <param name="UnsignalledConditions">Native conditions whose initial state was never signalled (served <c>state_known = false</c>);
|
|
/// null when the node has no condition hub.</param>
|
|
/// <param name="Methods">Remote condition method calls served, by outcome class.</param>
|
|
public sealed record OriginConditionDiagnostics(int OpenItems, int LargestListing, int ListingLimit, DateTime? LastSnapshotAtUtc,
|
|
long Resyncs, long CapacityRejections, int? UnsignalledConditions, ConditionMethodCounts Methods);
|
|
|
|
/// <summary>H4 origin-side remote-history evidence for one node (what it serves to peers over data connections).</summary>
|
|
/// <param name="Available">The node has a historian backend and can serve remote history.</param>
|
|
/// <param name="Sessions">Live peer history sessions.</param>
|
|
/// <param name="OpenContinuations">Origin continuations (page cursors and chunk remainders) held for peers.</param>
|
|
/// <param name="ReadsGood">Remote history items answered Good since process start.</param>
|
|
/// <param name="ReadsUncertain">Remote history items answered Uncertain since process start.</param>
|
|
/// <param name="ReadsBad">Remote history items answered Bad (including refusals) since process start.</param>
|
|
/// <param name="NoPeerTrafficYet">
|
|
/// True while no peer has called this node since start: the origin data services are created on the first peer call, so
|
|
/// the zeros are "no peer traffic yet", not missing evidence. False once they run. Default false, so a payload without the
|
|
/// member (Akka's JSON serializer fills a missing constructor argument with the CLR default) never claims it.
|
|
/// </param>
|
|
public sealed record OriginHistoryDiagnostics(bool Available, int Sessions, int OpenContinuations, long ReadsGood,
|
|
long ReadsUncertain, long ReadsBad, bool NoPeerTrafficYet = false);
|