statsy icon indicating copy to clipboard operation
statsy copied to clipboard

Allow setting a default sampling factor.

Open juliusv opened this issue 13 years ago • 4 comments

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.

juliusv avatar Oct 10 '12 10:10 juliusv

Could you please add a test that shows the data injected at construction propagates to the increment?

streadway avatar Oct 10 '12 11:10 streadway

Of course, I added tests for the default sampling. Sorry about that.

juliusv avatar Oct 10 '12 11:10 juliusv

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.

streadway avatar Oct 10 '12 15:10 streadway

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).

juliusv avatar Oct 10 '12 18:10 juliusv