Closed raykrueger closed 11 years ago
We try to keep ruby-statsd as lightweight as possible and this is definitely non-core functionality. I think it would be better (and quite easy) to package it as its own gem that depends on ruby-statsd. Perhaps we should create a wiki page that links to useful extensions like rack-statsd and this (see #41).
Roping in @raggi
Yep, totally understood. Like I said, it's a pattern I've gotten a lot of use out of and it's not tied to any outside tech, like rack. So I figured I'd throw it out there if you're interested.
On Fri, Apr 12, 2013 at 10:12 AM, Rein Henrichs notifications@github.com wrote:
We try to keep ruby-statsd as lightweight as possible and this is definitely non-core functionality. I think it would be better (and quite easy) to package it as its own gem that depends on ruby-statsd. Perhaps we should create a wiki page that links to useful extensions like rack-statsd and this.
Reply to this email directly or view it on GitHub: https://github.com/reinh/statsd/pull/40#issuecomment-16298421
@raykrueger I do think it's a cool pattern (although I have some performance concerns that may be partially alleviated by using a low sample rate), but I also don't think it's right for core statsd-ruby. I would love it if you made it a gem and would be happy to promote it from the wiki. What say you? :D
yep yep. I'll throw that together. Thanks!
This is a pattern I've used in one of the apps I have and figured it might be a useful contribution.
To use it simply wrap any object and call methods on it as normal.
For instance, if you wanted to time every call to a redis client:
Would produce timings such as: "Redis.get:1|ms" and "Redis.set:1|ms"
If the target raises any errors an "errors" counter is incremented: "Redis.get.errors:1|c" "Redis.set.errors:1|c"