feat(grpc-data): H4 remote-history diagnostics and metrics
Consumer and origin history evidence for data connections (plan §6):
- DataConnectionHistoryDiagnostics: otopcua.dataconn.history.reads{variant,status_class,side} and
otopcua.dataconn.history.continuations.active{side} on the exported OtOpcUa meter (the H2 origin
counter sat on a private meter the host never exported); the plan's unknown-bits counter is the
existing X0 otopcua.dataconnection.unknown_operations_dropped, reused
- per-connection projected answers by status class and open consumer continuations (settled on
resume claim or release); origin sessions, open continuations and answers by status class
- negotiated features and advertised history variants/aggregates per connection
- AdminUI data-connections page renders them plus the dropped unknown-operation bits (#919)
- H4 unit-phase manifest key
This commit is contained in:
+15
-2
@@ -46,6 +46,8 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
|
||||
private readonly object _sync = new();
|
||||
/// <summary>Diagnostics sink for the X0 dropped-operation warning; optional (an init property keeps the constructor shape).</summary>
|
||||
public ILogger Logger { private get; init; } = NullLogger.Instance;
|
||||
/// <summary>H4: consumer/origin remote-history evidence merged into the diagnostics; optional (init keeps the constructor shape).</summary>
|
||||
public DataConnectionHistoryDiagnostics? HistoryDiagnostics { get; init; }
|
||||
private IReadOnlyDictionary<string, DataOperations> _droppedOperations = new Dictionary<string, DataOperations>();
|
||||
private long _unknownOperationRows;
|
||||
private readonly string _node, _owner;
|
||||
@@ -118,7 +120,18 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
|
||||
DataOperations? Dropped(string id) => dropped.TryGetValue(id, out var bits) ? bits : DataOperations.None;
|
||||
int? MappingDrops(string id) => mappingsWithDroppedOperations is null ? null
|
||||
: mappingsWithDroppedOperations.TryGetValue(id, out var count) ? count : 0;
|
||||
return desired.Specs.Values.Select(spec =>
|
||||
var history = HistoryDiagnostics;
|
||||
ZB.MOM.WW.OtOpcUa.Commons.Interfaces.DataConnectionDiagnosticsSnapshot WithHistory(
|
||||
ZB.MOM.WW.OtOpcUa.Commons.Interfaces.DataConnectionDiagnosticsSnapshot row)
|
||||
{
|
||||
if (history is null) return row;
|
||||
var counts = history.CaptureConsumer(row.ConnectionId);
|
||||
return row with { HistoryReadsGood = counts.Good, HistoryReadsUncertain = counts.Uncertain, HistoryReadsBad = counts.Bad,
|
||||
OpenRemoteContinuations = counts.OpenContinuations };
|
||||
}
|
||||
return desired.Specs.Values.Select(spec => WithHistory(Capture(spec))).ToArray();
|
||||
|
||||
ZB.MOM.WW.OtOpcUa.Commons.Interfaces.DataConnectionDiagnosticsSnapshot Capture(Spec spec)
|
||||
{
|
||||
if (!_attemptPending && _scopeReady && _entries.TryGetValue(spec.Id, out var entry) && entry.Ready)
|
||||
return entry.Connection.CaptureDiagnostics(spec.Revision, desired.ScopeVersion, desired.ArtifactRevision) with
|
||||
@@ -128,7 +141,7 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
|
||||
_attemptPending ? "connecting" : _retryNotBefore > _clock.GetTimestamp() ? "backoff" : "connecting",
|
||||
null, null, 0, 0, desired.ScopeVersion, desired.ArtifactRevision, _clock.GetUtcNow().UtcDateTime)
|
||||
{ DroppedUnknownOperations = Dropped(spec.Id), MappingsWithDroppedOperations = MappingDrops(spec.Id) };
|
||||
}).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user