使用 Java(可选 .Net)收集应用程序指标

发布于 2024-09-25 09:33:50 字数 587 浏览 4 评论 0 原文

我希望能够从我的应用程序动态公开各种基于时间和计数的指标。 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巷雨优美回忆 2024-10-02 09:33:50

我最喜欢 Coda Hale 的 metrics 库,但您可能还想看看 Java Simon。其他选项包括stajisticsJAMon冻糕

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.

李不 2024-10-02 09:33:50

我建议查看 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文