使用Prometheus测量服务延迟 [英] Measure service latency with prometheus

查看:1190
本文介绍了使用Prometheus测量服务延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是普罗米修斯和格拉那那的新人...

I am new to prometheus and grafana...

我的主要目标是获取每个请求的响应时间.

My primary goal is to get the response time per request.

对我来说,这似乎很简单-但是无论我做什么,都无法获得所需的结果.

For me it seemed to be a simple thing - but whatever I do I do not get the results I require.

我需要能够分析最近几分钟/几小时/几天内的服务延迟. 我发现当前的实现是一个简单的摘要(没有分位数的定义),每15秒就会刮一次.

I need to be able to analyse the service lateny in the last minutes/hours/days. The current implementation I found was a simple SUMMARY (without definition of quantiles) which is scraped every 15s.

  1. 是否可以从我的普罗米修斯摘要中获取最后一分钟的平均请求延迟时间?
  2. 如果是:如何?如果不是:我该怎么办?

当前我正在使用以下查询:

Currently I am using the following query:

rate(http_response_time_sum{application="myapp",handler="myHandler", status="200"}[1m])
/
rate(http_response_time_count{application="myapp",handler="myHandler", status="200"}[1m])

我正在获得两个数据集".第一个的值为"NaN". 我想这是零除的结果.

I am getting two "datasets". The value of the first is "NaN". I suppose this is the result from adivision by zero.

提前THX!

(使用spring-client)

(using spring-client)

推荐答案

您的查询正确.如果过去一分钟没有查询,结果将为NaN.

Your query is correct. The result will be NaN if there have been no queries in the past minute.

这篇关于使用Prometheus测量服务延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆