Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collecting Application Metrics in Java (optionally .Net)

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.

like image 524
jtruelove Avatar asked Sep 30 '10 12:09

jtruelove


2 Answers

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.

like image 52
Niraj Tolia Avatar answered Oct 21 '22 20:10

Niraj Tolia


I would suggest taking a look at Coda Hale's presentation, and his metrics library. That should cover you from a Java perspective.

like image 9
jabley Avatar answered Oct 21 '22 21:10

jabley