jeffellis / grails-yammer-metrics

A plugin packaging the yammer metrics jars for use in Grails applications
Apache License 2.0
28 stars 21 forks source link

Support ability to have more control over full Timer Name #7

Closed kurtroy closed 10 years ago

kurtroy commented 11 years ago

Hello,

I installed your plugin, and it is very nice. Similar to the Guice annotations.

One issue I have with the plugin is that I lack control over the full metric name. If I put the @Timed on a controller "index()" method, I get this as the MBean in JConsole:

java.lang.reflect |->Constructor |->indexTimer |->Attributes

If I forward to Graphite, my metric name will be: java.lang.reflect.Constructor.indexTimer.Count (etc.)

Would it be possible to expose the full metric name on the annotation, similar to the MetricName class in Metrics? Something like:

@Timed(group="com.xxx.yyy", type="myType", name="myName" scope="myScope")

This would then show up in JConsole as:

com.xxx.yyy |->myType |-> myScope |->myName

and in Graphite, it would be: com.xxx.yyy.myType.myScope.myName

This would make the plugin awesome.

jeffellis commented 11 years ago

Great idea, I'll check into that.

Jeff

On 2/12/2013 7:34 PM, Kurt Roy wrote:

Hello,

I installed your plugin, and it is very nice. Similar to the Guice annotations.

One issue I have with the plugin is that I lack control over the full metric name. If I put the @Timed https://github.com/Timed on a controller "index()" method, I get this as the MBean in JConsole:

java.lang.reflect |->Constructor |->indexTimer |->Attributes

If I forward to Graphite, my metric name will be: java.lang.reflect.Constructor.indexTimer.Count (etc.)

Would it be possible to expose the full metric name on the annotation, similar to the MetricName class in Metrics? Something like:

@Timed https://github.com/Timed(group="com.xxx.yyy", type="myType", name="myName" scope="myScope")

This would then show up in JConsole as:

com.xxx.yyy |->myType |-> myScope |->myName

and in Graphite, it would be: com.xxx.yyy.myType.myScope.myName

This would make the plugin awesome.

— Reply to this email directly or view it on GitHub https://github.com/jeffellis/grails-yammer-metrics/issues/7.

sboles commented 11 years ago

This would also be nice for us. Maybe we'll submit a pull request shortly.

kurtroy commented 11 years ago

@jeffellis - I actually made some changes to this code to day to support these annotations:

@Timed(group="com.group", type="type", name='name') @Timed(group="com.group", type="type", name='name', scope="scope") @Metered(group="com.group", type="type", name="name") @Metered(group="com.group", type="type", name="name", scope="scope")

The annotation params map to the corresponding Metrics name components on the MetricName class.

One caveat: I just found out that the new 3.0.0.-BETA2 released in April changes around how the metric names can be specified. It will no longer use group/type/name to build names but rather a variable list of strings which turn into "." separated names.

If you are interested in seeing this code, I can push to my fork. Let me know. Thanks.

JoeDeVries commented 11 years ago

@kurtroy Part of you issue was fixed with issue #12.

jeffellis commented 10 years ago

This should be fixed in version 3.0.1-2 released today (2014-01-04).