简体   繁体   English

使用 Prometheus 的平均请求持续时间

[英]Average request duration using Prometheus

I have deployed the Istio Bookinfo application in a Kubernetes cluster.我已经在 Kubernetes 集群中部署了 Istio Bookinfo 应用程序。 Following the documentation, I'm trying to measure the average request duration using the following query:按照文档,我正在尝试使用以下查询来测量平均请求持续时间:

rate(istio_request_duration_milliseconds_sum[1m]) / rate(istio_request_duration_milliseconds_count[1m])

This query returns me "doubled" results ie for each request I get two results, with different Value but same source and destination , one labelled as reporter="source" and the other as reporter="destination" .这个查询返回我“加倍”的结果,即对于每个请求,我得到两个结果,具有不同的但相同的sourcedestination ,一个标记为report="source" ,另一个标记为 report ="destination" I was not able to find any clarification about it and I have not clear how these measures work.我找不到任何关于它的澄清,我也不清楚这些措施是如何运作的。 Why I have two values returned?为什么我返回了两个值?

The metrics are indeed reported from two sources, once from the request sender and another time from the request receiver.这些指标确实是从两个来源报告的,一次来自请求发送者,另一个来自请求接收者。 This is a bit redundant, but in some situations the values differ and especially for requests duration: from request sender ( reporter=source ), the duration stands for the whole request latency (server processing time + network roundtrip) whereas from the request receiver ( reporter=destination ), it stands mainly for server processing time.这有点多余,但在某些情况下,值会有所不同,尤其是请求持续时间:从请求发送者 ( reporter=source ) 开始,持续时间代表整个请求延迟(服务器处理时间 + 网络往返),而从请求接收者 ( reporter=destination ),它主要代表服务器处理时间。

In a few special situations there is no redundancy and metrics are only reported once (be it from source or from destination): eg when istio features such as fault injection or traffic mirroring come into play.在少数特殊情况下,没有冗余并且指标只报告一次(无论是来自源还是来自目标):例如,当故障注入或流量镜像等 istio 功能发挥作用时。

As a result, in Prometheus you should always filter all your queries with either {reporter="source"} or {reporter="destination"} .因此,在 Prometheus 中,您应该始终使用{reporter="source"}{reporter="destination"}过滤所有查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM