astefanutti / metrics-aspectj

AspectJ integration for Dropwizard Metrics
Apache License 2.0
81 stars 39 forks source link

Introduction of default MetricRegistry #3

Closed fizmax closed 10 years ago

fizmax commented 10 years ago

How about implementing some default MetricRegistry, so that the programmer was not forced to place @Registry("") annotation everywhere along with @Metrics? Only in case if he/she wants separate registries. Or even combine these two annotations and specify registry name in @Metrics annotation, like @Metrics(registry = ""), also with a default value :)

astefanutti commented 10 years ago

That's a great idea. Let's have a default MetricRegistry called metrics-registry created by default and available via the SharedMetricRegistries util class.

Having the registry specified as an attribute of the Metrics annotation sounds a good idea as well. The only limitation that I see for that approach is that the Metrics annotation only targets types for now so that all the methods within the same class will have to be instrumented within the same registry. However, that could be addressed by allowing the Metrics annotation to target methods as well so that would override the registry per method.