| 1 | # Single (or Simple) Exponential Smoothing (`ses`) |
| 2 | |
| 3 | > This query is also available as `ema` and `ewma`. |
| 4 | |
| 5 | An exponential moving average (`ema`), also known as an exponentially weighted moving average (`ewma`) |
| 6 | is a first-order infinite impulse response filter that applies weighting factors which decrease |
| 7 | exponentially. The weighting for each older datum decreases exponentially, never reaching zero. |
| 8 | |
| 9 | In simple terms, this is like an average value, but more recent values are given more weight. |
| 10 | |
| 11 | Netdata automatically adjusts the weight (`alpha`) based on the number of values processed, |
| 12 | using the formula: |
| 13 | |
| 14 | ``` |
| 15 | window = max(number of values, 15) |
| 16 | alpha = 2 / (window + 1) |
| 17 | ``` |
| 18 | |
| 19 | You can change the fixed value `15` by setting in `netdata.conf`: |
| 20 | |
| 21 | ``` |
| 22 | [web] |
| 23 | ses max window = 15 |
| 24 | ``` |
| 25 | |
| 26 | ## how to use |
| 27 | |
| 28 | Use it in alerts like this: |
| 29 | |
| 30 | ``` |
| 31 | alarm: my_alert |
| 32 | on: my_chart |
| 33 | lookup: ses -1m unaligned of my_dimension |
| 34 | warn: $this > 1000 |
| 35 | ``` |
| 36 | |
| 37 | `ses` does not change the units. For example, if the chart units is `requests/sec`, the exponential |
| 38 | moving average will be again expressed in the same units. |
| 39 | |
| 40 | It can also be used in APIs and badges as `&group=ses` in the URL. |
| 41 | |
| 42 | ## Examples |
| 43 | |
| 44 | Examining last 1 minute `successful` web server responses: |
| 45 | |
| 46 | -  |
| 47 | -  |
| 48 | -  |
| 49 | -  |
| 50 | |
| 51 | ## References |
| 52 | |
| 53 | - <https://en.wikipedia.org/wiki/Moving_average#exponential-moving-average> |
| 54 | - <https://en.wikipedia.org/wiki/Exponential_smoothing>. |
| 55 | |
| 56 |