我希望能够从我的应用程序动态公开各种基于时间和计数的指标。 Perf4j 对于时间来说效果很好,但不允许以我所知道的直接方式进行计数。
例如,我可以这样做
StopWatch dbWriteTime = new Log4JStopWatch("ServiceName:DBWrite");
dbWriteTime.start();
... execute DB stuff here
dbWriteTime.stop();
,您可以设置这些指标以任何时间间隔进行记录,它在这方面做得很好。但有时我想做一些事情,比如
Metric metric = new Metric("ServiceName:OrdersPerRequest");
metric.put(50);
我可以调用 perf4j 计时器库 50 次,但这是一个可怕且低效的黑客行为,无法在日志中获取我的指标。有谁知道一个可以执行这两种类型指标的优秀开源库?此外,如果它可以监视输出指标日志并将其转储到集中式数据库,那就太好了。此外,如果您知道一个很好的开源 Web 前端来绘制和显示此类数据,我对此非常感兴趣。看来这一定是很多人以前需要的东西。
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.
发布评论
评论(2)
我最喜欢 Coda Hale 的 metrics 库,但您可能还想看看 Java Simon。其他选项包括stajistics、JAMon 和冻糕。
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.
我建议查看 Coda Hale 的演示,以及他的指标 库。这应该能从 Java 的角度涵盖您。
I would suggest taking a look at Coda Hale's presentation, and his metrics library. That should cover you from a Java perspective.