statsy
statsy copied to clipboard
Allow setting a default sampling factor.
This allows setting a default sampling factor for a statsy client. Apparently (and sadly) the only common way to "scale" statsd so far is by downsampling on the clients. To make heavy use of this client-side downsampling, it can be useful to set this value to <1 as a default for an application.
Could you please add a test that shows the data injected at construction propagates to the increment?
Of course, I added tests for the default sampling. Sorry about that.
Hmm... this will not behave properly with batching as multiple batches can be collecting across different instances at the same time - one client instance constructed per batch.
Thanks for pointing that out. I didn't see that the class created another instance of itself further down. As far as I understand the batch code, all that is needed to make batching work is to pass the @default_sampling on to the child instance. Or am I missing something? (See my last added commit).