-1

how can one inject Coda Hale Metrics using Spring AOP and/or using http://www.ryantenney.com/metrics-spring/ library. Are there any examples out there?

sasha.j
  • 54
  • 3

1 Answers1

1

I figured it out. It would be great if all of the features in http://www.ryantenney.com/metrics-spring/ are documented :) But hey, that's why it is open source.

<metrics:annotation-driven metric-registry="metrics" />
<!-- Monitoring the controller  -->
<beans:bean id="monitoringInterceptor" class="com.ryantenney.metrics.spring.TimedMethodInterceptor">
    <beans:constructor-arg ref="metrics"/>
    <beans:constructor-arg>
        <beans:value type="java.lang.Class">org.myapp.controller.MyController</beans:value>
    </beans:constructor-arg>
</beans:bean>

<aop:config>
    <!-- name of the class or interface -->
    <aop:pointcut id="monitoringPointcut" expression="execution(* org.myapp.controller.MyController..*(..))"/>
    <aop:advisor advice-ref="monitoringInterceptor" pointcut-ref="monitoringPointcut"/>
</aop:config>  
sasha.j
  • 54
  • 3