Trend and prediction functions
Trend functions read gauges — values that go up and down — and answer how much a value moved, which way it is heading, and where it will be.
changes
Counts how many times each series changed value within the range window. Good for spotting flapping states and config churn.
delta
Computes the difference between the first and last value of each series in the range window, extrapolated to the window ends. The gauge counterpart of increase: how much did this value move.
deriv
Computes the per-second derivative of each series using simple linear regression over the range window — a smoothed answer to "which way is this gauge heading, and how fast".
double_exponential_smoothing
Smooths each series using double exponential (Holt-Winters) smoothing: sf weighs recent samples, tf weighs recent trend. Produces a stable signal from a noisy gauge.
Example
Smooth the query-service goroutine gauge with balanced smoothing and trend factors.
sum(double_exponential_smoothing(go_goroutines{app_kubernetes_io_name="query-service"}[30m], 0.5, 0.5))
| Value |
|---|
64,783.09 |
|
Both factors are between 0 and 1: lower This function was named |
idelta
Computes the difference between the last two samples in the range window — the most recent movement of a gauge.
predict_linear
Predicts the value of each series t seconds from now by linear regression over the range window. The classic capacity alert: fire when disk will be full in four hours, not when it is full.
Example
Project the query-service goroutine count one hour ahead based on the last 30 minutes.
sum(predict_linear(go_goroutines{app_kubernetes_io_name="query-service"}[30m], 3600))
| Value |
|---|
64,614.52 |
|
Linear extrapolation only — for trends that curve, use the forecasting algorithms: AI and ML Capabilities. |