JAX-RS资源监控
我想监视由 JAX-RS 资源(带有 JAX-RS 注释的 ejb)组成的 Java EE 6 应用程序。例如,我想知道在一段时间内发出了多少个请求以及完成每个请求所需的时间(以及结果)。我怎样才能做到这一点?
现在,我考虑编写一个拦截器,将每个 EJB 调用记录在 RRDTool 存储中,以便进行事后分析。但是,这样做我将无法获取请求信息。
我还读过有关 JMX 的内容,但找不到任何与 Web 服务相关的内容(特别是 JAX-RS)。
有没有任何工具或库可以帮助做到这一点?如果没有的话,我该如何开发呢?有什么想法吗?
I'd like to monitor an Java EE 6 application that is composed of JAX-RS resources (ejbs with JAX-RS annotations). I want to know, for instance, how many requests were made in some period and the time it took for each request to be completed (and the result). How can I do that?
For now I thought on writing an Interceptor that records each EJBs invocation in a RRDTool storage for posterior analisys. But, by doing this I won't be able to get the request information.
Also I've read about JMX, but coudn't find anything related to webservices (JAX-RS specifically).
Is there any tool or library that helps on doing this? If not, how can I develop it? Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JAX-RS 的优点是请求通过 HTTP,因此如果您可以获得 HTTP 统计信息,那么您基本上就拥有了 JAX-RS 统计信息。
在 RHQ 中,我们通过向 servlet 中注入过滤器来收集统计信息,将它们转储到日志文件中来实现此目的我们可以使用一种格式,然后读取日志文件并将数据注入到我们的指标集合中。
JAX-RS has the beauty that requests go over HTTP, so if you can get the at the HTTP stats, you basically have the JAX-RS stats.
In RHQ we are doing this by injecting a filter into the servlet to gather the stats, dump them to a logfile in a format we can consume and then later read the logfile and inject the data into our metric collection.