Trend and prediction functions :: Kloudfuse Docs
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.
Syntax
changes(<gauge>[<range>])
Parameters
| Parameter | Required | Description |
|---|---|---|
<range> |
Required | The trailing window to compute over. |
Example
Count how often the query-service goroutine gauge changed value in ten minutes.
max(changes(go_goroutines{app_kubernetes_io_name="query-service"}[10m]))
| Value |
|---|
| 19 |
Expected output
| A perfectly flat series returns 0; every scrape-to-scrape difference counts once. |
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.
Syntax
delta(<gauge>[<range>])
Parameters
| Parameter | Required | Description |
|---|---|---|
<range> |
Required | The trailing window to compute over. |
Example
Measure how much the query-service goroutine count changed over the last 30 minutes.
sum(delta(go_goroutines{app_kubernetes_io_name="query-service"}[30m]))
| Value |
|---|
| 34.06 |
Expected output
For counters use increase, which handles resets. |
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".
Syntax
deriv(<gauge>[<range>])
Parameters
| Parameter | Required | Description |
|---|---|---|
<range> |
Required | The trailing window to compute over. |
Example
Estimate the current growth rate of query-service goroutines.
sum(deriv(go_goroutines{app_kubernetes_io_name="query-service"}[30m]))
| Value |
|---|
| 0.02797 |
Expected output
Regression smooths noise better than delta / window, at slightly more cost. |
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.
Syntax
double_exponential_smoothing(<gauge>[<range>], <sf>, <tf>)
Parameters
| Parameter | Required | Description |
|---|---|---|
<range> |
Required | The trailing window to compute over. |
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 |
Expected output
Both factors are between 0 and 1: lower sf smooths harder, higher tf follows trend changes faster.This function was named holt_winters in Prometheus 2.x; Kloudfuse uses the current name. |
idelta
Computes the difference between the last two samples in the range window — the most recent movement of a gauge.
Syntax
idelta(<gauge>[<range>])
Parameters
| Parameter | Required | Description |
|---|---|---|
<range> |
Required | The trailing window to compute over. |
Example
See the latest sample-to-sample change in query-service goroutines.
sum(idelta(go_goroutines{app_kubernetes_io_name="query-service"}[10m]))
| Value |
|---|
| 35 |
Expected output
Like irate, idelta is volatile by design; use delta for smoother trends. |
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.
Syntax
predict_linear(<gauge>[<range>], <seconds-ahead>)
Parameters
| Parameter | Required | Description |
|---|---|---|
<range> |
Required | The trailing window to compute over. |
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 |
Expected output
| Linear extrapolation only — for trends that curve, use the forecasting algorithms: AI and ML Capabilities. |