Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor a service bean using @timed annotation?

Jhipster dev team recommends to use @Timed annotation for the services you want to monitor.

It is presented in the creating a service page ( http://jhipster.github.io/creating_a_service.html ).

So how it works in JHipster? How can I monitor these services annotated? And what is the cost to maintain this annotation in all services? Any processing overhead by using this annotation in production?

like image 922
Rafael Gorski Avatar asked Nov 12 '15 16:11

Rafael Gorski


1 Answers

JHipster uses DropWizard Metrics (have you seen the tech stack here?), and those @Timed annotations come from the Spring support for Dropwizard Metrics.

To have more information about DropWizard Metrics, here is their website.

There is of course an overhead, but it depends on how you use those annotations: if it's on a Service bean that will do just one database access, then you should not worry about it, as the database access is orders of magnitude more resource intensive. We use it for very high trafic applications without any issue, and anyway in case of performance issue we'd better have some monitoring than being blind!

Of course you can then monitor those services, that's the whole point:

  • Metrics provides a wide range of reporting tools, the most obvious one being JMX, which is the default tool in Java.
  • JHipster provides an AngularJS view on top of Metrics in its administration screens, and that's one of the great features of JHipster. Just run your application with mvn and go to the administration screens.
like image 197
Julien Dubois Avatar answered Sep 22 '22 02:09

Julien Dubois