【问题标题】:How to monitor the time span between the request and response using prometheus java client如何使用prometheus java客户端监控请求和响应之间的时间跨度
【发布时间】:2017-03-17 13:46:49
【问题描述】:

我正在编写一个 Restful web api。我正在使用 prometheus 来监控我的 api 。例如,这就是我记录总请求数和失败请求数的方式。

static final Counter requests = Counter.build()
         .name("requests_total").help("Total requests.").register();
static final Counter failedRequests = Counter.build()
         .name("requests_failed_total").help("Total failed requests.").register();

然后我像下面这样增加计数器

requests.inc();
failedRequests.inc();

我想以同样的方式监控 api 调用的请求和响应之间的时间跨度。是否有普罗米修斯 java 客户端可以帮助我做到这一点。? 在此先感谢

【问题讨论】:

    标签: java prometheus


    【解决方案1】:

    摘要的计时功能可以让您这样做:https://github.com/prometheus/client_java#summary

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-27
      • 2014-09-20
      • 2019-07-26
      • 1970-01-01
      • 2012-12-02
      • 1970-01-01
      相关资源
      最近更新 更多