I want to be able to expose various time and count based metrics dynamically from my applications. Perf4j works out pretty well for the time ones but does not allow for count in a straightforward way that I'm aware of.
for instance I can do
StopWatch dbWriteTime = new Log4JStopWatch("ServiceName:DBWrite");
dbWriteTime.start();
... execute DB stuff here
dbWriteTime.stop();
and you can set these metrics to get logged at whatever interval and it does a great job of that. But sometimes I want to do something like
Metric metric = new Metric("ServiceName:OrdersPerRequest");
metric.put(50);
I could call the perf4j timer lib 50 times but that is a horrible and inefficient hack to get my metrics in the log. Does anyone know a good open source library that can do both types of metrics? Also if it could monitor the output metric logs and dump them to a centralized DB that would be great. Additionally if you know of a good open source web front end to graph and display this sort of data I'd be very interested in that. It seems this must be something a lot of people have needed before.
I like Coda Hale's metrics library the best but you might also want to look at Java Simon. Other options include stajistics, JAMon, and parfait.
I would suggest taking a look at Coda Hale's presentation, and his metrics library. That should cover you from a Java perspective.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With