refactor(kpi): shared public KpiMetrics catalog — source consts + UI pages key off one symbol (#178)

This commit is contained in:
Joseph Doherty
2026-06-19 02:04:10 -04:00
parent 47f5ca687c
commit e51104af5f
9 changed files with 135 additions and 30 deletions
@@ -293,9 +293,9 @@ public partial class AuditLogPage : IDisposable
/// <summary>The metrics rendered in the panel, in display order.</summary>
private static readonly (string Metric, string Title, string? Unit)[] TrendMetrics =
{
("totalEventsLastHour", "Events / hour", null),
("errorEventsLastHour", "Error events / hour", null),
("backlogTotal", "Backlog", null),
(KpiMetrics.AuditLog.TotalEventsLastHour, "Events / hour", null),
(KpiMetrics.AuditLog.ErrorEventsLastHour, "Error events / hour", null),
(KpiMetrics.AuditLog.BacklogTotal, "Backlog", null),
};
/// <summary>Per-metric series state, keyed by the metric name.</summary>
@@ -593,13 +593,13 @@
var siteId = _trendSiteId;
(_connectionsDownSeries, _connectionsDownAvailable, _connectionsDownError) =
await LoadTrendSeriesAsync("connectionsDown", siteId, fromUtc, toUtc);
await LoadTrendSeriesAsync(KpiMetrics.SiteHealth.ConnectionsDown, siteId, fromUtc, toUtc);
(_deadLettersSeries, _deadLettersAvailable, _deadLettersError) =
await LoadTrendSeriesAsync("deadLetters", siteId, fromUtc, toUtc);
await LoadTrendSeriesAsync(KpiMetrics.SiteHealth.DeadLetters, siteId, fromUtc, toUtc);
(_scriptErrorsSeries, _scriptErrorsAvailable, _scriptErrorsError) =
await LoadTrendSeriesAsync("scriptErrors", siteId, fromUtc, toUtc);
await LoadTrendSeriesAsync(KpiMetrics.SiteHealth.ScriptErrors, siteId, fromUtc, toUtc);
(_sfBufferDepthSeries, _sfBufferDepthAvailable, _sfBufferDepthError) =
await LoadTrendSeriesAsync("sfBufferDepth", siteId, fromUtc, toUtc);
await LoadTrendSeriesAsync(KpiMetrics.SiteHealth.SfBufferDepth, siteId, fromUtc, toUtc);
}
finally
{
@@ -279,11 +279,11 @@
// one metric's failure only blanks that one chart while the others still
// render their fetched data — and a throw never breaks the KPI tiles above.
(_queueDepthSeries, _queueDepthAvailable, _queueDepthError) =
await LoadSeries("queueDepth", fromUtc, toUtc);
await LoadSeries(KpiMetrics.NotificationOutbox.QueueDepth, fromUtc, toUtc);
(_parkedSeries, _parkedAvailable, _parkedError) =
await LoadSeries("parkedCount", fromUtc, toUtc);
await LoadSeries(KpiMetrics.NotificationOutbox.ParkedCount, fromUtc, toUtc);
(_deliveredSeries, _deliveredAvailable, _deliveredError) =
await LoadSeries("deliveredLastInterval", fromUtc, toUtc);
await LoadSeries(KpiMetrics.NotificationOutbox.DeliveredLastInterval, fromUtc, toUtc);
}
finally
{
@@ -591,11 +591,11 @@ public partial class SiteCallsReport
var fromUtc = toUtc - TimeSpan.FromHours(_windowHours);
(_bufferedSeries, _bufferedAvailable, _bufferedError) =
await LoadSeriesAsync("buffered", fromUtc, toUtc);
await LoadSeriesAsync(KpiMetrics.SiteCallAudit.Buffered, fromUtc, toUtc);
(_parkedSeries, _parkedAvailable, _parkedError) =
await LoadSeriesAsync("parked", fromUtc, toUtc);
await LoadSeriesAsync(KpiMetrics.SiteCallAudit.Parked, fromUtc, toUtc);
(_failedSeries, _failedAvailable, _failedError) =
await LoadSeriesAsync("failedLastInterval", fromUtc, toUtc);
await LoadSeriesAsync(KpiMetrics.SiteCallAudit.FailedLastInterval, fromUtc, toUtc);
}
finally
{