Skip to content

Add metrics for total heap memory usage from MemoryMXBean #9859

Open
@liustanley

Description

@liustanley

Is your feature request related to a problem? Please describe.

The heap memory JVM metrics are currently being obtained from MemoryPoolMXBean.

I'm having difficulty calculating the correct maximum total values from the current jvm.memory.* metrics because they're divided by the memory pool attribute. For example, if I want to calculate the maximum total heap memory usage, it's possible to sum up the values from:

max:process.runtime.jvm.memory.usage{type:heap, pool:eden_space} + max:process.runtime.jvm.memory.usage{type:heap, pool:tenured_gen} + max:process.runtime.jvm.memory.usage{type:heap, pool:survivor_space}

But if a service has multiple JVM instances, then it becomes difficult to distinguish between the JVM instances and this query will sum across all JVM instances in this service.

If there was another metric for process.runtime.jvm.total.memory.usage (from MemoryMXBean), then we could query max:process.runtime.jvm.total.memory.usage{type:heap} for the correct total maximum heap memory across all JVM instances in the same service.

Describe the solution you'd like

I'd like to add the following heap memory JVM metrics from MemoryMXBean:

  • process.runtime.jvm.total.memory.usage
  • process.runtime.jvm.total.memory.committed
  • process.runtime.jvm.total.memory.init
  • process.runtime.jvm.total.memory.limit

I can help open a PR for this if the feature request is approved.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions