influxdata / kapacitor

Open source framework for processing, monitoring, and alerting on time series data
MIT License
2.32k stars 493 forks source link

Sigma Stateful function should have rolling window period #978

Open nathanielc opened 8 years ago

nathanielc commented 8 years ago

The stateful sigma function is useful in that it computes deviations from the norm easily, but currently it doesn't support limiting the window that it tracks. Meaning it computes the moving mean and stddev for all points seen forever. For it to be more useful, older values need to be forgotten via a moving window. Essentially this should look like the moving_average function but with the sigma pieces added on.

austinbutler commented 7 years ago

Is this still planned?

rubycut commented 6 years ago

Yes, this is important, I am reluctant to even use sigma, since it seems that it is tracking data since task was created.

patrickvallet commented 6 years ago

Hi, I am trying to calculate sigma value manually but I a quite far from my alert value. What is the formula use? Is it realy the standard deviation forumula? There's no details about that in any document. If it's really comutes deviations for all points seen forever, that is not very nice in my opinion also.

scottwilson312 commented 6 years ago

The running mean of a defined window seems much more useful than the running mean of the entire history

ashishkaransingh commented 5 years ago

Thank you @nathanielc for providing confirmation. In the mean time we can use stddev as the following which will calculate standard deviation correctly using windows.

|window()
.period(5m)
.every(5m)
|where(lambda: isPresent("Percent_Processor_Time"))
|eval(lambda: "Percent_Processor_Time")
  .as('Percent_Processor_Time')
|stddev('Percent_Processor_Time')
  .as('StdDev_1_Percent_Processor_Time')
gabzim commented 3 years ago

I thought this was the implemented behavior, a bit surprised to find it's not. I guess this is not going to be addressed?