Class ServerBandwidthReportBuilder
Assembles the bandwidth page from what the report queries return. Pure, so the rules — "no data" is null, a tier sums only servers that reported, a peak is the busiest point of the summed series — are testable without a database.
public static class ServerBandwidthReportBuilder
- Inheritance
-
ServerBandwidthReportBuilder
- Inherited Members
Methods
Build(DateTime, ServerBandwidthRange, IEnumerable<ServerBandwidthWindowRow>, IEnumerable<ServerBandwidthPointRow>, IEnumerable<ServerBandwidthPointRow>, IEnumerable<ServerBandwidthKindPointRow>, int, string?, IEnumerable<ServerBandwidthRates>?)
Builds the report. The inputs are not modified.
public static ServerBandwidthReport Build(DateTime nowUtc, ServerBandwidthRange range, IEnumerable<ServerBandwidthWindowRow> windows, IEnumerable<ServerBandwidthPointRow> currents, IEnumerable<ServerBandwidthPointRow> peaks, IEnumerable<ServerBandwidthKindPointRow> kindSeries, int scopeKind, string? scopeName, IEnumerable<ServerBandwidthRates>? serverSeries)
Parameters
nowUtcDateTimeThe database clock the rows were read at.
rangeServerBandwidthRangeThe charted range.
windowsIEnumerable<ServerBandwidthWindowRow>Every server's fixed-window totals.
currentsIEnumerable<ServerBandwidthPointRow>Each server's latest minute, only where it is fresh.
peaksIEnumerable<ServerBandwidthPointRow>Each server's busiest point of the range.
kindSeriesIEnumerable<ServerBandwidthKindPointRow>Per tier and chart point, the servers' rates summed.
scopeKindintThe chart's tier, or 0.
scopeNamestringThe chart's server, or null.
serverSeriesIEnumerable<ServerBandwidthRates>The scoped server's own points, when
scopeNameis set.
Returns
Busiest(IEnumerable<ServerBandwidthRates>)
The point with the most UDP payload sent per second — the measured egress figure — or null when there are no points. Ties go to the earlier point.
public static ServerBandwidthRates? Busiest(IEnumerable<ServerBandwidthRates> points)
Parameters
pointsIEnumerable<ServerBandwidthRates>
Returns
Sum(int, IReadOnlyCollection<ServerBandwidthServerSummary>)
Adds servers together. A window is null when no member has it, and the current rate is the sum over the members that reported one: a silent server contributes nothing rather than a zero that would read as "idle".
public static ServerBandwidthTierSummary Sum(int kind, IReadOnlyCollection<ServerBandwidthServerSummary> members)
Parameters
kindintmembersIReadOnlyCollection<ServerBandwidthServerSummary>
Returns
SumSeries(IEnumerable<ServerBandwidthKindPointRow>)
The per-tier points summed per bucket, oldest first.
public static List<ServerBandwidthRates> SumSeries(IEnumerable<ServerBandwidthKindPointRow> kindSeries)
Parameters
kindSeriesIEnumerable<ServerBandwidthKindPointRow>