jeffellis/grails-yammer-metrics — pull request #12 by JoeDeVries (2013-06-18 16:51:31+00:00)
Title: Fix for Issue #10 - malformed metric names when deployed as a WAR

Please consider the following solution to this problem. The behavior I observed was that when running as a WAR, ReflectionUtils.getCallingClass(2), returns different results than when running with run-app.

When running with run-app the 0-3 entries are:
0: org.springsource.loaded.ri.ReflectiveInterceptor
1: org.grails.plugins.yammermetrics.groovy.GroovierMetrics
2: [instrumented class]
3: java.lang.reflect.Constructor OR [instrumented class]$$EnhancerByCGLIB$$89abcdef

When running with run-war the 0-3 entries are:
0: org.grails.plugins.yammermetrics.groovy.GroovierMetrics
1: [instrumented class]
2: java.lang.reflect.Constructor OR [instrumented class]$$EnhancerByCGLIB$$89abcdef
3: org.codehaus.groovy.grails.commons.AbstractGrailsClass OR java.lang.reflect.Constructor

My solution is to blacklist packages that may occur before the instrumented class, such that entry 0 will always be the desired class.