9cff87fe85
Remove project bookkeeping citations from shipped code comments across the solution: hyphenated task IDs (WP-14, StoreAndForward-025), milestone/task/ issue refs (M3, Task 4, Audit Log #23, #21), Bundle X task-bundle labels, and C/D/K/S/T phase labels. Comment text only — no code logic, string/log literals, or XML-doc structure changed. Genuine descriptions are preserved (only the citation is stripped), and technical lookalikes are retained (UTF-8, SHA-256, T00:00:00, M365, UTC-5, pre-C4/pre-C5 schema versions). Flagged by the new CommentChecker TaskReferenceInComment / TrackingReferenceInComment checks plus targeted grep passes; full solution builds clean, append-only guard tests pass.
52 lines
3.0 KiB
C#
52 lines
3.0 KiB
C#
using ZB.MOM.WW.ScadaBridge.Commons.Types.Kpi;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
|
|
|
/// <summary>
|
|
/// CentralUI facade over
|
|
/// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories.IKpiHistoryRepository"/>
|
|
/// ("KPI History & Trends"). The reusable trend chart talks to this
|
|
/// service rather than the repository directly so tests can substitute a fake
|
|
/// without spinning up EF Core, and so the bucketing / downsampling step lives in
|
|
/// one place rather than being re-implemented per page.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The query path fetches the raw series for one (source, metric, scope, scopeKey)
|
|
/// tuple over <c>[fromUtc, toUtc]</c> and reduces it with
|
|
/// <see cref="KpiSeriesBucketer"/> to at most <c>maxPoints</c> points. Mirroring
|
|
/// <see cref="IAuditLogQueryService"/>, the production implementation opens its own
|
|
/// DI scope per call so a chart's auto-load never contends with the circuit-scoped
|
|
/// <c>ScadaBridgeDbContext</c>; a second (test-seam) constructor injects the
|
|
/// repository directly.
|
|
/// </remarks>
|
|
public interface IKpiHistoryQueryService
|
|
{
|
|
/// <summary>
|
|
/// Returns the bucketed series for one
|
|
/// (<paramref name="source"/>, <paramref name="metric"/>, <paramref name="scope"/>,
|
|
/// <paramref name="scopeKey"/>) tuple over <c>[<paramref name="fromUtc"/>,
|
|
/// <paramref name="toUtc"/>]</c>, reduced to at most
|
|
/// <paramref name="maxPoints"/> points (defaulting to
|
|
/// <c>KpiHistoryOptions.DefaultMaxSeriesPoints</c> when null).
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The window must be non-degenerate (<paramref name="toUtc"/> strictly after
|
|
/// <paramref name="fromUtc"/>) and the effective max must be at least 2 — the
|
|
/// page layer guarantees both; this service passes them straight through to
|
|
/// <see cref="KpiSeriesBucketer.Bucket"/>, which throws
|
|
/// <see cref="ArgumentOutOfRangeException"/> on violation.
|
|
/// </remarks>
|
|
/// <param name="source">Source identifier — a value from <c>KpiSources</c>.</param>
|
|
/// <param name="metric">Metric name from the source's catalog.</param>
|
|
/// <param name="scope">Scope discriminator — a value from <c>KpiScopes</c>.</param>
|
|
/// <param name="scopeKey">Scope qualifier (site id / node name); <c>null</c> for the Global scope.</param>
|
|
/// <param name="fromUtc">Inclusive lower bound of the time window (UTC).</param>
|
|
/// <param name="toUtc">Inclusive upper bound of the time window (UTC); must be after <paramref name="fromUtc"/>.</param>
|
|
/// <param name="maxPoints">Optional ceiling on returned points; defaults to the configured default when null.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>A task resolving to the bucketed series in ascending bucket-start order.</returns>
|
|
Task<IReadOnlyList<KpiSeriesPoint>> GetSeriesAsync(
|
|
string source, string metric, string scope, string? scopeKey,
|
|
DateTime fromUtc, DateTime toUtc, int? maxPoints = null, CancellationToken cancellationToken = default);
|
|
}
|