fix(review): calc ReadOne reports an inputs-Bad publish; VT inputs-bad counter ticks only on a real report
This commit is contained in:
@@ -394,7 +394,11 @@ public sealed class CalculationDriver : IDriver, IDependencyConsumer, ISubscriba
|
||||
var now = DateTime.UtcNow;
|
||||
lock (_lock)
|
||||
{
|
||||
if (!_stateByRawPath.TryGetValue(reference, out var st) || !st.HasValue)
|
||||
// Gated on HAS PUBLISHED, not on "has a value": a tag whose only publish was an inputs-Bad
|
||||
// report has no value of its own, and answering BadWaitingForInitialData for it would tell a
|
||||
// polled reader "never observed" while the subscriber on the same node had been told
|
||||
// BadNoCommunication. Something HAS been observed about such a tag — that its input is dead.
|
||||
if (!_stateByRawPath.TryGetValue(reference, out var st) || !st.HasPublished)
|
||||
return new DataValueSnapshot(null, StatusBadWaitingForInitialData, null, now);
|
||||
// Exactly what the subscriber was last told — including a propagated input sub-code. Deriving
|
||||
// it from a two-state flag here would make a read disagree with the subscription over the
|
||||
|
||||
@@ -328,11 +328,14 @@ public sealed class VirtualTagActor : ReceiveActor
|
||||
/// <param name="timestampUtc">The triggering change's timestamp, stamped on the result.</param>
|
||||
private void OnInputsBad(uint worstInputStatus, DateTime timestampUtc)
|
||||
{
|
||||
OtOpcUaTelemetry.VirtualTagEval.Add(1, new KeyValuePair<string, object?>("outcome", "inputs-bad"));
|
||||
|
||||
if (!AllDependenciesArrived()) return;
|
||||
if (_hasPublished && _lastPublishedStatus == worstInputStatus) return;
|
||||
|
||||
// Metered BELOW both guards, so the counter measures tags that actually REPORT Bad inputs. Above
|
||||
// them it also counted every warm-up trigger — a dependency that has simply not arrived yet — which
|
||||
// is ordinary cold start, and burying the real signal in it is how a counter stops being trusted.
|
||||
OtOpcUaTelemetry.VirtualTagEval.Add(1, new KeyValuePair<string, object?>("outcome", "inputs-bad"));
|
||||
|
||||
_hasPublished = true;
|
||||
_lastPublishedStatus = worstInputStatus;
|
||||
Context.Parent.Tell(new EvaluationResult(
|
||||
|
||||
Reference in New Issue
Block a user