When you are running long term applications like web applications, it is good to know some statistics about them, like number of requests served, request durations, or the number active requests. But also some more generic information like the state of your internal collections, how many times some portion of code is being executed, or health checks like database availability, or any kind of connection to an external system.
All this kind of instrumentalization can be achieved by using native JMX or using a modular project like Metrics. Metrics provides a powerful way to measure the behaviour of your critical components and reporting them to a variety of systems like, JConsole, System Console, Ganglia, Graphite, CSV, or making them available through a web server.
To install Metrics, we only have to add metrics dependency. In this example we are going to use Maven.
Recommended Titles
JavaScript
Patterns Stoyan
Stefanov
Java
Concurrency in Practiceby
Brian
Goetz
Java
Performance by
Charlie
Hunt Effective
Java by Joshua
Bloch
The
Well-Grounded Java Developer by Martijn
Verburg