istio_request_bytes_count 和 istio_request_bytes_sum 的区别?

Difference between istio_request_bytes_count and istio_request_bytes_sum?

谁能简单解释一下 istio_request_bytes_count 和 istio_request_bytes_sum 的区别?以及为什么缺少“istio_request_bytes”标准指标。

Istio Standard Metrics notes that istio_request_bytes is a DISTRIBUTION type metric. In Prometheus, this would appear as a histogram metric。因此,您应该会看到三个指标:

  • istio_request_bytes_count是请求数
  • istio_request_bytes_sum 是所有请求加在一起的总字节数
  • istio_request_bytes_bucket{le="1024"} 是请求大小为 1 KiB 或更小的请求总数

您可以通过总和除以计数来计算平均请求大小。您还可以使用 histogram_quantile() 等 Prometheus 函数来计算中位数(第 50 个百分位)大小。

这也适用于其他标准指标。一个常见的衡量指标是第 95 个百分位数的延迟(“p95”);执行 95% 的请求需要多长时间,而剩下的 5% 需要比这更长的时间? histogram_quantile(0.95, istio_request_duration_milliseconds_bucket[1h]) 可以在最近一个小时内进行计算。