Search code examples
kubernetesprometheusistio

What is the difference between istio_request_bytes_count and istio_request_bytes_sum?


Can someone briefly explain what is the difference between istio_request_bytes_count and istio_request_bytes_sum?. And why is the "istio_request_bytes" standard metric is missing?


Solution

  • Istio Standard Metrics notes that istio_request_bytes is a DISTRIBUTION type metric. In Prometheus, this would appear as a histogram metric. So, you should see three metrics:

    • istio_request_bytes_count is the number of requests
    • istio_request_bytes_sum is the total number of bytes, added together across all requests
    • istio_request_bytes_bucket{le="1024"} is the total number of requests where the request size is 1 KiB or smaller

    You can calculate the average request size by dividing the sum by the count. You can also use Prometheus functions like histogram_quantile() to calculate the median (50th-percentile) size.

    This also applies to the other standard metrics. A common thing to measure is 95th-percentile latency ("p95"); how long does it take 95% of the requests to execute, where the remaining 5% take longer than this? histogram_quantile(0.95, istio_request_duration_milliseconds_bucket[1h]) could compute this over the most recent hour.