Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
688 views
in Technique[技术] by (71.8m points)

monitoring - Measure service latency with 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.

I need to be able to analyse the service latency 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. Is it possible to get the average request latency of the last minute from my Prometheus SUMMARY?
  2. If YES: How? If NO: What should I do?

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])

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

(I am using spring-client).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...