jvm_memory_bytes_used{service="x", area="heap"} vs java_lang_memory_heapmemoryusage_used{service="x"}

81 views
Skip to first unread message

Tigran

unread,
Nov 25, 2020, 8:35:35 AM11/25/20
to Prometheus Users
Hello,

I am running a k8s cluster with 2 instances, and I noticed that I have a lot of difference between this two metrics, I would like to undertand why they return a different value.

metrics from jvm_memory_bytes_used{service="x", area="heap"}  (instance 1 and 2)
java_lang_memory_heapmemoryusage_used{service="x"} (intsance 1 and 2)


The difference is ~20mb for the first instance of x and ~10mb for the second.

I am  using jmx_prometheus_javaagent:0.14.0 exporter in a tomcat runing azul jdk8

Brian Brazil

unread,
Nov 25, 2020, 8:57:36 AM11/25/20
to Tigran, Prometheus Users
Most likely a race due to them being fetched at slightly different times in the scrape, as the value is coming from the exact same mBean. You can drop all the java_lang stuff when using the jmx exporter, as jvm_memory_bytes_used and friends already provide you with that out of the box and is a better structured metric.

--

Alex

unread,
Jan 21, 2021, 3:08:53 PM1/21/21
to Prometheus Users
Hi Brian,
Sorry to revive an old thread. You mentioned we can drop all java_lang stuff as jvm_ prefixed metrics are provided out of the box and are better structured. I was not able to see any of the jvm metrics.
When using the JMX prometheus exporter, I set my rules to:
- pattern: ".*

The only metrics I am able to see are java_lang prefixed metrics. No jvm_ prefix.

This is with corretto openJDK 1.8.0_265.
Reply all
Reply to author
Forward
0 new messages