Prometheus: different between count and sum metrics

1. Caddy version (caddy version):

v2.4.3

2. How I run Caddy:

systemctl start caddy.service

a. System environment:

RockyLinux 8.4 with systemd

b. Command:

curl -s localhost:2019/metrics|grep caddy_http_response_size_bytes_

c. Service/unit/compose file:

n/a

d. My complete Caddyfile or JSON config:

n/a

3. The problem I’m having:

On exported prometheus monitoring, there are 3 kinds of metrics about caddy_http_response_size_bytes: bucket, count, sum.

What’s the difference of caddy_http_response_size_bytes_count and caddy_http_response_size_bytes_sum?

4. Error messages and/or full log output:

n/a

5. What I already tried:

n/a

6. Links to relevant resources:

Hi @adhisimon,

The caddy_http_response_size_bytes metric is a histogram, and so there are a few different metrics exposed about it.

Please read the Prometheus docs on histograms for a full explanation, but to quickly answer your question:

  • the _count metric is the total number of observations made (i.e. if 50 responses were observed, the value would be 50)
  • the _sum metric is the sum of all observed values (i.e. if the value of all 50 observed responses were 0.5, the value would be 25.0)
3 Likes