Codahale Metrics: using @Timed metrics annotation in plain Java

后端 未结 8 996
南方客
南方客 2020-12-29 03:18

I am trying to add metrics to a plain Java application using codahale metrics. I\'d like to use the @Timed annotation, but it is unclear to me which MetricRegistry it uses,

8条回答
  •  盖世英雄少女心
    2020-12-29 03:40

    You could also use stagemonitor-core for that. See documentation here and here. The advantage is that stagemonitor (which is free & open source btw) does not depend on any container-based AOP like Spring AOP or EJB interceptors. It uses bytecode manipulation via runtime attachment which means that you do not even have to add a -javaagent flag to your application startup - a plain dependency is enough.

    If you want to measure the execution time in a web application or in a remote EJB application, you don't even have to manually annotate your code. Also, stagemonitor offers preconfigured Grafana and Kibana dashboards.

    Disclaimer: I'm one of the developers of stagemonitor

提交回复
热议问题