Cue / scales

scales - Metrics for Python
Apache License 2.0
920 stars 73 forks source link

PmfStat: do not accumulate values forever #20

Open gjcarneiro opened 10 years ago

gjcarneiro commented 10 years ago

Hi, I love this Scales module, it's been very useful. However, one thing that bothers me is this PmfStat. Suppose I am measuring the login delays on a web site. If I leave the web server running for a week, the pmf stats reported to graphite are a combination of the current login delays but also taking into account all the login delays over the entire week. This means that, if there is an anomaly, and login times shoot up to become 10 times bigger, this change will hardly even be noticed in the mean value reported by PmfStat.

If I am sending data every minute to graphite I would like this data to represent only the last minute interval, not days or weeks of accumulated data. I am not sure how to achieve this with Scales.

gjcarneiro commented 10 years ago

I misread scales. Apparently it has an array of 1028 samples, and new samples overwrite previous samples in this array. So, in a way old values end up being forgotten.

Still, this is not ideal. Why 1028? In my case 1028 is too much. It should really be a sliding window, with time based cutoff.