codahale/metrics — pull request #283 by stephenbhadran (2012-09-07 00:33:45+00:00)
Title: Added ElementType.TYPE to Timed, Metered & ExceptionMetered Target annotation

Hi Coda,
I started using metrics this week and its been working great so far. I am able to instrument my webapp and jax-rs resources and was able to publish metrics to Graphite pretty quickly. Thanks for "metrics" and for the wonderful presentation (http://codahale.com/codeconf-2011-04-09-metrics-metrics-everywhere.pdf).

I have some 20+ JAX-RS/Jersey Resources implemented in 5 different Services, and I'm trying to instrument all of them by annotating the method with @Timed. Problem is - its repetitive and the annotation is in every Service and every Method.

It'll be nice to have a functionality where I could just annotate the Service at the Class level and if the "InstrumentedResourceMethodDispatchProvider" could look for the annotation at the class level and instrument the method.

I've attempted to code this. Please review and give feedback:
1) Currently, I'm looking for the annotation at the class level first, followed by looking for it at the Method level - the Method level takes precedence if found.
2) Should I use a separate annotation for class level may be?? (@TimedService ??)

thanks,
Stephen

PS : New to github and this is my first pull request, so apologize in advance if I'm not doing some things correctly. I'd like to contribute, so would appreciate guidance. Thx.