Promotheus: discrepancy in sum vs avg

7/30/2020

I have micrometer-prometheus jvm metrics monitoring configured for my spring boot application, which is deployed in kubernetes pods. There are 2 pods.

When I run query avg(jvm_memory_max_bytes), I see graph hovering mostly around 400mb value. When I run sum(jvm_memory_max_bytes), graph jumps up to 10gb value.

Is this much variation normal?

-- Mandroid
grafana
kubernetes
prometheus

1 Answer

7/30/2020

The metric jvm_memory_max_bytes shows:

The maximum amount of memory in bytes that can be used for memory management.

So the value will not change according to its consumption but rather on how much memory is available.

If you are trying to get how much memory has been used, you need to use the metric: jvm_memory_used_bytes.

You can find more information on this page, under 3. JVM Metrics.

-- Juliano Costa
Source: StackOverflow