micrometer-metrics/micrometer

System memory metrics

Open

#5,234 建立於 2024年6月27日

在 GitHub 查看
 (9 留言) (1 反應) (0 負責人)Java (4,220 star) (935 fork)batch import
enhancementhelp wantedinstrumentationmodule: micrometer-core

描述

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.

貢獻者指南