boundary / folsom

Expose Erlang Events and Metrics
Apache License 2.0
585 stars 166 forks source link

Add a sliding window sample types for histograms #25

Closed russelldb closed 12 years ago

russelldb commented 12 years ago

I got these reviewed using Basho internal process and merged to our fork. If you want me to squash the commits down, let me know.

Also, the tests for the slide and slide_uniform samples are quickcheck tests. They're ifdef'd out so just won't run without eqc installed. I added a standard eunit test for the slide sample, too, for those who won't ever run quickcheck.

Let me know if you don't have quickcheck, or if you want me to try and add a commit so Proper (http://proper.softlab.ntua.gr/) can be used instead.


Uses ets to store a reservoir of readings for a sliding window sample.

Uses a gen_server to trim the size of the table every window / 2 seconds.


The time to calculate statistics is dependant on the number of samples. On a busy server a sliding window reservoir can end up with a lot of readings (20k ops/sec is 60*20k readings). This PR provides a hybrid sample type that keeps at most N readings per second in the sliding window, using a random uniform sample of the presented readings.

joewilliams commented 12 years ago

Yeah looks like this PR needs to be rebased (can't be merged automatically) and also, yes, please squash it into one commit.

russelldb commented 12 years ago

Closing and reopening from a rebased and squashed branch.