-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
The class JvmMemoryMetrics offers memory metrics, but those are all related to heap and non heap values and do not expose the actual memory limits of the machine/container on which the application is running.
It'd be an improvement to offer some additional metrics in this class, such as
system.memory.max
system.memory.used
The metrics are available in the OperatingSystemMXBean classes in the Oracle and IBM JREs, and are already used by Micrometer to expose CPU metrics in the class io.micrometer.core.instrument.binder.system.ProcessorMetrics.
My use case would be to measure my application running inside a container in Kubernetes. With these metrics I would be able to know the percentage of available memory being used by the application.
The io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics is not enough to do it. For instance, by default Metaspace size is unlimited and Micrometer returns -1 when trying to read it.
The most important metric missing is getTotalPhysicalMemorySize, without it there's no way to build a Grafana panel that shows the percentage of memory being used by an application.