feat(kpi): K3 — KpiHistory project + options/validator + AddKpiHistory

This commit is contained in:
Joseph Doherty
2026-06-17 19:45:07 -04:00
parent cabc557629
commit 9ffa34d3e7
7 changed files with 341 additions and 0 deletions
@@ -0,0 +1,38 @@
namespace ZB.MOM.WW.ScadaBridge.KpiHistory;
/// <summary>
/// Configuration for the KPI History (#26, M6) component. Bound from the
/// <c>ScadaBridge:KpiHistory</c> section of <c>appsettings.json</c>. Defaults
/// reflect the design: a 60-second sampling cadence for the point-in-time
/// Notification Outbox / Site Call Audit KPI snapshots, a 90-day central
/// retention window with a daily purge sweep, and a 200-point default ceiling
/// on the series returned to the Central UI trend charts.
/// </summary>
public sealed class KpiHistoryOptions
{
/// <summary>
/// How often the recorder captures a KPI sample row (default 60 s). Must be
/// strictly positive.
/// </summary>
public TimeSpan SampleInterval { get; set; } = TimeSpan.FromSeconds(60);
/// <summary>
/// Central retention window in days for recorded KPI samples (default 90,
/// range <c>[1, 3650]</c>). Rows older than this are dropped by the purge
/// sweep.
/// </summary>
public int RetentionDays { get; set; } = 90;
/// <summary>
/// How often the purge sweep drops expired sample rows (default 1 day). Must
/// be strictly positive.
/// </summary>
public TimeSpan PurgeInterval { get; set; } = TimeSpan.FromDays(1);
/// <summary>
/// Default ceiling on the number of points returned in a single trend series
/// query when the caller does not specify one (default 200, range
/// <c>[2, 5000]</c>). At least two points are required to draw a line.
/// </summary>
public int DefaultMaxSeriesPoints { get; set; } = 200;
}