Recipe
Steady-state hypothesis monitor
Detect when a monitored system has reached equilibrium so you can stop burning compute on transient noise.
Ingredients
- Sliding window of the last N observations
- Linear regression over the window
- Slope threshold ε for declaring flat
- Consecutive-flat counter with hysteresis
Method
- Push each incoming metric into a fixed-size ring buffer.
- Once the buffer is full, fit a least-squares line to the points.
- If |slope| < ε, increment the flat counter; otherwise reset it to zero.
- When the flat counter exceeds a configured threshold K, emit a STEADY event and suppress further emissions until the slope breaks the band.
Tuning
| Parameter | Start | Notes |
|---|---|---|
| Window N | 60 | Larger = more lag, less jitter |
| Slope ε | 0.001 | Scale-dependent; normalize first |
| Flat count K | 5 | Prevents premature steady declaration |
Gotchas
A flat slope on raw values can mask constant-rate drift. Consider differencing the series first if the process has a known trend component. Also guard against empty windows on cold start — defer evaluation until the buffer saturates.