our use case: tracking php memory usage means,percentile, etc of php pagerequests by using the timing metric. obviously this caused a whole lot of requests (thousands per second), making statsd memory usage go through the roof.
the README suggests samplerate is only accepted for counters. and statsd.js only has explicit code for samplerate support for counters.
I think this can be extended (note that sample client libs such as https://github.com/etsy/statsd/blob/master/examples/php-example.php have explicit support for sampling all metric types, although it's not fully implemented in statsd.js or even documented in the readme), so you can already send any metric sampled in your client.
here's what needs/can be done in statsd.js (in addition to updating the readme):
I cleaned up the PHP example and removed the sampleRate parameters in my pull request since stats.js didn't support it. If your proposal goes in, we can get those parameters added back in.
i noticed that timers are the only metric types that consume (by far) more cpu than any other metric, so sampling them is pretty much the only way to keep statsd cpu usage under control as your number of metrics increases
Did your version of stats.js support sample rate on timers? The mainline version did not at the time I made the change.