feat(kpi): K1 — KpiSample + IKpiSampleSource + IKpiHistoryRepository contracts (Commons)

This commit is contained in:
Joseph Doherty
2026-06-17 19:35:50 -04:00
parent 4c6ae9da0e
commit 460777bffa
7 changed files with 270 additions and 0 deletions
@@ -0,0 +1,21 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Types.Kpi;
/// <summary>
/// Canonical KPI scope discriminators (M6 "KPI History &amp; Trends") — the value of
/// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiSample.Scope"/>. Each
/// constant's value equals its name. The companion
/// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiSample.ScopeKey"/> qualifies
/// the scope: <c>null</c> for <see cref="Global"/>, the site id for <see cref="Site"/>,
/// the node name for <see cref="Node"/>.
/// </summary>
public static class KpiScopes
{
/// <summary>System-wide sample; <c>ScopeKey</c> is <c>null</c>.</summary>
public const string Global = "Global";
/// <summary>Per-site sample; <c>ScopeKey</c> is the site id.</summary>
public const string Site = "Site";
/// <summary>Per-node sample; <c>ScopeKey</c> is the node name.</summary>
public const string Node = "Node";
}
@@ -0,0 +1,11 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Types.Kpi;
/// <summary>
/// A single bucketed point of a KPI series (M6 "KPI History &amp; Trends") — the
/// aggregated value of one series over the bucket starting at
/// <see cref="BucketStartUtc"/>. Returned by the bucketed query path and the
/// reusable trend chart.
/// </summary>
/// <param name="BucketStartUtc">UTC start of the time bucket this point covers.</param>
/// <param name="Value">Aggregated value for the bucket — counts exact; ages as seconds.</param>
public readonly record struct KpiSeriesPoint(DateTime BucketStartUtc, double Value);
@@ -0,0 +1,22 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Types.Kpi;
/// <summary>
/// Canonical KPI source identifiers (M6 "KPI History &amp; Trends") — the value of
/// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiSample.Source"/> and the
/// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Kpi.IKpiSampleSource.Source"/>
/// each owning component reports. Each constant's value equals its name.
/// </summary>
public static class KpiSources
{
/// <summary>Notification Outbox (#21) delivery KPIs.</summary>
public const string NotificationOutbox = "NotificationOutbox";
/// <summary>Site Call Audit (#22) cached-call KPIs.</summary>
public const string SiteCallAudit = "SiteCallAudit";
/// <summary>Audit Log (#23) ingest / backlog KPIs.</summary>
public const string AuditLog = "AuditLog";
/// <summary>Site Health (#11) monitoring KPIs.</summary>
public const string SiteHealth = "SiteHealth";
}