PromQL Note for Adding JVM Version Information to Micrometer Metrics
⚠️ This article was automatically translated by OpenAI (gpt-4o-mini). It may be edited eventually, but please be aware that it may contain incorrect information at this time.
This is a PromQL note for adding JVM version information to Micrometer's Prometheus metrics.
JVM information can be obtained from the following metric.
jvm_info{app="lognroll"}
I want to add this information to the following metric.
jvm_memory_used_bytes{app="lognroll"}
We will use the * operator for multiplication. Since the value of jvm_info is 1, the result will ultimately return the value of jvm_memory_used_bytes. We specify the matching labels with on (...) and keep the left labels with group_left.
jvm_memory_used_bytes{app="lognroll"} * on (app, instance) group_left(version, runtime, vendor) jvm_info{app="lognroll"}
Note
Exposing the software version to Prometheus https://www.robustperception.io/exposing-the-software-version-to-prometheus/