detectTrend

fnTrend detectTrend(T)(MetricCollector!T collector, Duration window)

Detects the trend in a metric collector over a time window.

Analyzes the values in the window to determine if the metric is increasing, decreasing, stable, or volatile.

Parameters

TThe type of the metric value.
collectorThe MetricCollector to analyze.
windowThe time window to analyze.

Returns

A Trend value indicating the detected trend.

Example:

auto trend = detectTrend(cpuHistory, 5.minutes);
if (trend == Trend.INCREASING) {
  writeln("CPU usage is rising");
}