ewma Metrics Operator
The ewma
operator computes an Exponentially Weighted Moving Average (EWMA) on the data points returned by the query for the selected time range. This allows you to smooth out short-term fluctuations (outliers) and display long-term trends.
You can optionally run ewma
with either:
- An explicit
alpha
smoothing parameter to smooth time series while preserving trends. This is useful if you want to explicitly set the smoothing parameter value. - A
span
over a number of points. Thespan
parameter is commonly understood as an N-Day Exponentially Weighted Moving Average. The span value is the number of data points that will be used to calculate the average. The decay (smoothing) parameter alpha is related to span as:alpha = 2/(span + 1)
The most commonly used parameter is span
, which allows you to specify the number of data points you want to use for smoothing. The higher the value of span
, the smoother the time series will be. You might choose to use alpha
if you know what smoothing parameter value you want use. Keep in mind that the lower the alpha
value is, the smoother the time series will be.
If you run ewma
without specifying either alpha
or span
, it runs by default with alpha=0.5
(orspan=3
).
Syntax​
ewma [alpha=<decimal> | span=<integer>]
Where:
alpha
, the smoothing parameter, is a decimal value (0.0 ≤ alpha ≤ 1.0) The default value ofalpha
is 0.5span
is the number of data points. Must be a positive integer. If you setspan=5
, the last five data points will be used to calculate the average. The default value ofspan
is 3.
Examples​
Using alpha​
metric=CPU_Idle | ewma alpha=0.1
Using span​
metric=CPU_Idle | ewma span=10