Skip to content

System memory metrics #5234

@fabcmartins

Description

@fabcmartins

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementA general enhancementhelp wantedAn issue that a contributor can help us withinstrumentationAn issue that is related to instrumenting a componentmodule: micrometer-coreAn issue that is related to our core module

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions