Merge historian follow-up (#1089): HistorianUnreachable on /alarms-historian + otopcua.alarm_historian.unreachable gauge; per-writer reachability tests; SqlServer writer no longer counts login/connection failures as answered
This commit is contained in:
@@ -52,6 +52,15 @@ else
|
||||
<div class="metric-card">
|
||||
<h2 class="panel-head">Drain state</h2>
|
||||
<div class="kv"><span class="k">State</span><span class="v"><span class="@StateChipClass(_status.DrainState)">@_status.DrainState</span></span></div>
|
||||
@if (_status.HistorianUnreachable)
|
||||
{
|
||||
@* #1089: an outage (the historian itself is not answering; rows are held) - distinct from a stuck queue. *@
|
||||
<div class="kv"><span class="k">Health</span><span class="v"><span class="chip chip-bad" data-testid="historian-unreachable" title="No write has reached the historian recently; queued rows are held and will drain when it answers again.">Historian unreachable</span></span></div>
|
||||
}
|
||||
else if (_status.Stalled)
|
||||
{
|
||||
<div class="kv"><span class="k">Health</span><span class="v"><span class="chip chip-warn" data-testid="queue-stalled" title="Rows are queued but none has been delivered or dead-lettered for the stall threshold, and the historian is not known to be down.">Queue stalled</span></span></div>
|
||||
}
|
||||
<div class="kv"><span class="k">Last drain</span><span class="v">@(_status.LastDrainUtc?.ToString("u") ?? "—")</span></div>
|
||||
<div class="kv"><span class="k">Last success</span><span class="v">@(_status.LastSuccessUtc?.ToString("u") ?? "—")</span></div>
|
||||
@if (!string.IsNullOrWhiteSpace(_status.LastError))
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace ZB.MOM.WW.OtOpcUa.Runtime.Historian;
|
||||
/// <list type="bullet">
|
||||
/// <item><c>otopcua.alarm_historian.queue.stalled</c> — 1 when rows are queued on the draining node and none has been
|
||||
/// delivered or dead-lettered for <c>AlarmHistorian:StallThresholdHours</c>; else 0. Alert on it.</item>
|
||||
/// <item><c>otopcua.alarm_historian.unreachable</c> — 1 when the queue is held because the historian is unreachable (#1089,
|
||||
/// mutually exclusive with <c>queue.stalled</c>).</item>
|
||||
/// <item><c>otopcua.alarm_historian.queue.depth</c> / <c>.dead_letter_depth</c> — rows waiting / dead-lettered.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
@@ -21,6 +23,9 @@ public static class AlarmHistorianMetrics
|
||||
/// <summary>Gauge name: 1 while the queue is stalled.</summary>
|
||||
public const string StalledGaugeName = "otopcua.alarm_historian.queue.stalled";
|
||||
|
||||
/// <summary>Gauge name: 1 while the historian is unreachable and the queue is held (#1089).</summary>
|
||||
public const string UnreachableGaugeName = "otopcua.alarm_historian.unreachable";
|
||||
|
||||
private static volatile IAlarmHistorianSink? _sink;
|
||||
|
||||
static AlarmHistorianMetrics()
|
||||
@@ -28,6 +33,9 @@ public static class AlarmHistorianMetrics
|
||||
OtOpcUaTelemetry.Meter.CreateObservableGauge(
|
||||
StalledGaugeName, () => Status()?.Stalled == true ? 1 : 0, unit: "{state}",
|
||||
description: "1 when alarm events are queued on the draining node and none was delivered or dead-lettered for AlarmHistorian:StallThresholdHours (a long outage or retry-forever rows at the queue head).");
|
||||
OtOpcUaTelemetry.Meter.CreateObservableGauge(
|
||||
UnreachableGaugeName, () => Status()?.HistorianUnreachable == true ? 1 : 0, unit: "{state}",
|
||||
description: "1 when the alarm queue has made no progress for AlarmHistorian:StallThresholdHours because the historian itself is unreachable (an outage, not a stuck queue; rows are held). Distinct from queue.stalled.");
|
||||
OtOpcUaTelemetry.Meter.CreateObservableGauge(
|
||||
"otopcua.alarm_historian.queue.depth", () => Status()?.QueueDepth ?? 0L, unit: "{event}",
|
||||
description: "Alarm events waiting in the store-and-forward queue.");
|
||||
|
||||
Reference in New Issue
Block a user