From d752d70148be0382e1de2962dcbf09dc4b1b4c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Martins?= Date: Wed, 17 Jul 2024 10:12:44 -0300 Subject: [PATCH 1/6] Binders for the environment memory metrics the application is running in --- .../binder/system/MemoryMetrics.java | 169 ++++++++++++++++++ .../binder/system/MemoryMetricsTest.java | 119 ++++++++++++ 2 files changed, 288 insertions(+) create mode 100644 micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java create mode 100644 micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java new file mode 100644 index 000000000..47995299b --- /dev/null +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java @@ -0,0 +1,169 @@ +/* + * Copyright 2017 VMware, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.micrometer.core.instrument.binder.system; + +import io.micrometer.common.lang.NonNullApi; +import io.micrometer.common.lang.NonNullFields; +import io.micrometer.common.lang.Nullable; +import io.micrometer.core.instrument.*; +import io.micrometer.core.instrument.binder.BaseUnits; +import io.micrometer.core.instrument.binder.MeterBinder; + +import java.lang.management.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; + +import static java.util.Collections.emptyList; +import static java.util.Objects.requireNonNull; + +/** + * Record metrics that report memory usage. + * + * @author Fábio C. Martins + */ +@NonNullApi +@NonNullFields +public class MemoryMetrics implements MeterBinder { + + /** + * List of public, exported interface class names from supported JVM implementations. + */ + private static final List OPERATING_SYSTEM_BEAN_CLASS_NAMES = Arrays.asList( + "com.ibm.lang.management.OperatingSystemMXBean", // J9 + "com.sun.management.OperatingSystemMXBean" // HotSpot + ); + + private final OperatingSystemMXBean operatingSystemBean; + + @Nullable + private final Class operatingSystemBeanClass; + + private final Iterable tags; + + @Nullable + private final Method committedVirtualMemorySize; + @Nullable + private final Method totalSwapSpaceSize; + @Nullable + private final Method freeSwapSpaceSize; + @Nullable + private final Method freePhysicalMemorySize; + @Nullable + private final Method totalPhysicalMemorySize; + + public MemoryMetrics() { + this(emptyList()); + } + + public MemoryMetrics(Iterable tags) { + this.tags = tags; + this.operatingSystemBean = ManagementFactory.getOperatingSystemMXBean(); + this.operatingSystemBeanClass = getFirstClassFound(OPERATING_SYSTEM_BEAN_CLASS_NAMES); + this.committedVirtualMemorySize = detectMethod("getCommittedVirtualMemorySize"); + this.totalSwapSpaceSize = detectMethod("getTotalSwapSpaceSize"); + this.freeSwapSpaceSize = detectMethod("getFreeSwapSpaceSize"); + this.freePhysicalMemorySize = detectMethod("getFreePhysicalMemorySize"); + this.totalPhysicalMemorySize = detectMethod("getTotalPhysicalMemorySize"); + } + + @Override + public void bindTo(MeterRegistry registry) { + Runtime runtime = Runtime.getRuntime(); + if (committedVirtualMemorySize != null) { + Gauge.builder("system.virtualmemory.commited", operatingSystemBean, x -> invoke(committedVirtualMemorySize)) + .tags(tags) + .baseUnit(BaseUnits.BYTES) + .description("The amount of virtual memory in bytes that is commited for the Java virtual machine to use") + .register(registry); + } + + if (totalSwapSpaceSize != null) { + Gauge.builder("system.swap.total", operatingSystemBean, x -> invoke(totalSwapSpaceSize)) + .tags(tags) + .baseUnit(BaseUnits.BYTES) + .description("The total amount of swap space in bytes") + .register(registry); + } + + if (freeSwapSpaceSize != null) { + Gauge.builder("system.swap.free", operatingSystemBean, x -> invoke(freeSwapSpaceSize)) + .tags(tags) + .baseUnit(BaseUnits.BYTES) + .description("The amount of free swap space in bytes") + .register(registry); + } + + if (freePhysicalMemorySize != null) { + Gauge.builder("system.memory.free", operatingSystemBean, x -> invoke(freePhysicalMemorySize)) + .tags(tags) + .baseUnit(BaseUnits.BYTES) + .description("The amount of free physical memory in bytes") + .register(registry); + } + + if (totalPhysicalMemorySize != null) { + Gauge.builder("system.memory.total", operatingSystemBean, x -> invoke(totalPhysicalMemorySize)) + .tags(tags) + .baseUnit(BaseUnits.BYTES) + .description("The total amount of physical memory in bytes") + .register(registry); + } + } + + private double invoke(@Nullable Method method) { + try { + return method != null ? toDouble((Number) method.invoke(operatingSystemBean)) : Double.NaN; + } + catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return Double.NaN; + } + } + + private double toDouble(@Nullable Number number) { + return number != null ? number.doubleValue() : Double.NaN; + } + + @Nullable + private Method detectMethod(String name) { + requireNonNull(name); + if (operatingSystemBeanClass == null) { + return null; + } + try { + // ensure the Bean we have is actually an instance of the interface + operatingSystemBeanClass.cast(operatingSystemBean); + return operatingSystemBeanClass.getMethod(name); + } + catch (ClassCastException | NoSuchMethodException | SecurityException e) { + return null; + } + } + + @Nullable + private Class getFirstClassFound(List classNames) { + for (String className : classNames) { + try { + return Class.forName(className); + } + catch (ClassNotFoundException ignore) { + } + } + return null; + } + +} diff --git a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java new file mode 100644 index 000000000..c913cf14a --- /dev/null +++ b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java @@ -0,0 +1,119 @@ +/* + * Copyright 2017 VMware, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.micrometer.core.instrument.binder.system; + +import io.micrometer.common.util.internal.logging.InternalLogger; +import io.micrometer.common.util.internal.logging.InternalLoggerFactory; +import io.micrometer.core.instrument.Gauge; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.BaseUnits; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.Duration; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** + * Tests for {@link MemoryMetrics}. + * + * @author Fábio C. Martins + */ +class MemoryMetricsTest { + private final InternalLogger logger = InternalLoggerFactory.getInstance(MemoryMetricsTest.class); + + MeterRegistry registry = new SimpleMeterRegistry(); + + @BeforeEach + void setup() { + new MemoryMetrics().bindTo(registry); + } + + @Test + void memoryMetrics() { + Gauge virtualMemCommited = registry.get("system.virtualmemory.commited").gauge(); + assertThat(virtualMemCommited.value()).isGreaterThanOrEqualTo(0); + assertThat(virtualMemCommited.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); + logger.info("{}", virtualMemCommited.value()); + + Gauge swapTotal = registry.get("system.swap.total").gauge(); + assertThat(swapTotal.value()).isGreaterThanOrEqualTo(0); + assertThat(swapTotal.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); + logger.info("{}", swapTotal.value()); + + Gauge swapFree = registry.get("system.swap.free").gauge(); + assertThat(swapFree.value()).isGreaterThanOrEqualTo(0); + assertThat(swapFree.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); + logger.info("{}", swapFree.value()); + + Gauge memFree = registry.get("system.memory.free").gauge(); + assertThat(memFree.value()).isGreaterThanOrEqualTo(0); + assertThat(memFree.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); + logger.info("{}", memFree.value()); + + Gauge memTotal = registry.get("system.memory.total").gauge(); + assertThat(memTotal.value()).isGreaterThanOrEqualTo(0); + assertThat(memTotal.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); + logger.info("{}", memTotal.value()); + + await().atMost(Duration.ofMillis(5000)); + logger.info("{}", virtualMemCommited.value()); + logger.info("{}", swapTotal.value()); + logger.info("{}", swapFree.value()); + logger.info("{}", memFree.value()); + logger.info("{}", memTotal.value()); + } + + @Test + void hotspotMetrics() { + assumeFalse(isOpenJ9()); + + assertThat(registry.get("system.virtualmemory.commited").gauge().value()).isNotNegative(); + assertThat(registry.get("system.swap.total").gauge().value()).isNotNegative(); + assertThat(registry.get("system.swap.free").gauge().value()).isNotNegative(); + assertThat(registry.get("system.memory.free").gauge().value()).isNotNegative(); + assertThat(registry.get("system.memory.total").gauge().value()).isNotNegative(); + } + + @Test + void j9Metrics() { + assumeTrue(isOpenJ9()); + + assertThat(registry.get("system.virtualmemory.commited").gauge().value()).isGreaterThanOrEqualTo(-1); + assertThat(registry.get("system.swap.total").gauge().value()).isNotNegative(); + assertThat(registry.get("system.swap.free").gauge().value()).isNotNegative(); + assertThat(registry.get("system.memory.free").gauge().value()).isGreaterThanOrEqualTo(-1); + assertThat(registry.get("system.memory.total").gauge().value()).isNotNegative(); + } + + private boolean isOpenJ9() { + return classExists("com.ibm.lang.management.OperatingSystemMXBean"); + } + + private boolean classExists(String className) { + try { + Class.forName(className); + return true; + } + catch (ClassNotFoundException e) { + return false; + } + } +} From 5fde87bfea3666c33188461133f95f0b1b2dd75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Martins?= Date: Wed, 17 Jul 2024 10:26:58 -0300 Subject: [PATCH 2/6] Binders for the environment memory metrics the application is running in --- .../binder/system/MemoryMetricsTest.java | 34 ++----------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java index c913cf14a..19d5e3598 100644 --- a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java +++ b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java @@ -15,8 +15,6 @@ */ package io.micrometer.core.instrument.binder.system; -import io.micrometer.common.util.internal.logging.InternalLogger; -import io.micrometer.common.util.internal.logging.InternalLoggerFactory; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.binder.BaseUnits; @@ -24,10 +22,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.time.Duration; - import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -37,8 +32,6 @@ * @author Fábio C. Martins */ class MemoryMetricsTest { - private final InternalLogger logger = InternalLoggerFactory.getInstance(MemoryMetricsTest.class); - MeterRegistry registry = new SimpleMeterRegistry(); @BeforeEach @@ -49,47 +42,29 @@ void setup() { @Test void memoryMetrics() { Gauge virtualMemCommited = registry.get("system.virtualmemory.commited").gauge(); - assertThat(virtualMemCommited.value()).isGreaterThanOrEqualTo(0); assertThat(virtualMemCommited.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); - logger.info("{}", virtualMemCommited.value()); Gauge swapTotal = registry.get("system.swap.total").gauge(); - assertThat(swapTotal.value()).isGreaterThanOrEqualTo(0); + assertThat(swapTotal.value()).isNotNegative(); assertThat(swapTotal.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); - logger.info("{}", swapTotal.value()); Gauge swapFree = registry.get("system.swap.free").gauge(); - assertThat(swapFree.value()).isGreaterThanOrEqualTo(0); + assertThat(swapFree.value()).isNotNegative(); assertThat(swapFree.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); - logger.info("{}", swapFree.value()); Gauge memFree = registry.get("system.memory.free").gauge(); - assertThat(memFree.value()).isGreaterThanOrEqualTo(0); assertThat(memFree.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); - logger.info("{}", memFree.value()); Gauge memTotal = registry.get("system.memory.total").gauge(); - assertThat(memTotal.value()).isGreaterThanOrEqualTo(0); + assertThat(memTotal.value()).isNotNegative(); assertThat(memTotal.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); - logger.info("{}", memTotal.value()); - - await().atMost(Duration.ofMillis(5000)); - logger.info("{}", virtualMemCommited.value()); - logger.info("{}", swapTotal.value()); - logger.info("{}", swapFree.value()); - logger.info("{}", memFree.value()); - logger.info("{}", memTotal.value()); } @Test void hotspotMetrics() { assumeFalse(isOpenJ9()); - assertThat(registry.get("system.virtualmemory.commited").gauge().value()).isNotNegative(); - assertThat(registry.get("system.swap.total").gauge().value()).isNotNegative(); - assertThat(registry.get("system.swap.free").gauge().value()).isNotNegative(); assertThat(registry.get("system.memory.free").gauge().value()).isNotNegative(); - assertThat(registry.get("system.memory.total").gauge().value()).isNotNegative(); } @Test @@ -97,10 +72,7 @@ void j9Metrics() { assumeTrue(isOpenJ9()); assertThat(registry.get("system.virtualmemory.commited").gauge().value()).isGreaterThanOrEqualTo(-1); - assertThat(registry.get("system.swap.total").gauge().value()).isNotNegative(); - assertThat(registry.get("system.swap.free").gauge().value()).isNotNegative(); assertThat(registry.get("system.memory.free").gauge().value()).isGreaterThanOrEqualTo(-1); - assertThat(registry.get("system.memory.total").gauge().value()).isNotNegative(); } private boolean isOpenJ9() { From 53c493a1bc33c0603faa42a6af12fe7e33383751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Martins?= Date: Wed, 17 Jul 2024 10:38:38 -0300 Subject: [PATCH 3/6] Binders for the environment memory metrics the application is running in --- .../core/instrument/binder/system/MemoryMetrics.java | 11 ++++++++--- .../instrument/binder/system/MemoryMetricsTest.java | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java index 47995299b..8dc9990ca 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java @@ -44,8 +44,8 @@ public class MemoryMetrics implements MeterBinder { * List of public, exported interface class names from supported JVM implementations. */ private static final List OPERATING_SYSTEM_BEAN_CLASS_NAMES = Arrays.asList( - "com.ibm.lang.management.OperatingSystemMXBean", // J9 - "com.sun.management.OperatingSystemMXBean" // HotSpot + "com.ibm.lang.management.OperatingSystemMXBean", // J9 + "com.sun.management.OperatingSystemMXBean" // HotSpot ); private final OperatingSystemMXBean operatingSystemBean; @@ -57,12 +57,16 @@ public class MemoryMetrics implements MeterBinder { @Nullable private final Method committedVirtualMemorySize; + @Nullable private final Method totalSwapSpaceSize; + @Nullable private final Method freeSwapSpaceSize; + @Nullable private final Method freePhysicalMemorySize; + @Nullable private final Method totalPhysicalMemorySize; @@ -88,7 +92,8 @@ public void bindTo(MeterRegistry registry) { Gauge.builder("system.virtualmemory.commited", operatingSystemBean, x -> invoke(committedVirtualMemorySize)) .tags(tags) .baseUnit(BaseUnits.BYTES) - .description("The amount of virtual memory in bytes that is commited for the Java virtual machine to use") + .description( + "The amount of virtual memory in bytes that is commited for the Java virtual machine to use") .register(registry); } diff --git a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java index 19d5e3598..27b3a4f18 100644 --- a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java +++ b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java @@ -32,6 +32,7 @@ * @author Fábio C. Martins */ class MemoryMetricsTest { + MeterRegistry registry = new SimpleMeterRegistry(); @BeforeEach @@ -88,4 +89,5 @@ private boolean classExists(String className) { return false; } } + } From 813adcdab0c6e608370053d71b154f120df1e44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Martins?= Date: Tue, 23 Jul 2024 18:54:48 -0300 Subject: [PATCH 4/6] Renaming of gauge to better reflect the virtual memory metric --- .../micrometer/core/instrument/binder/system/MemoryMetrics.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java index 8dc9990ca..6e80114b3 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java @@ -89,7 +89,7 @@ public MemoryMetrics(Iterable tags) { public void bindTo(MeterRegistry registry) { Runtime runtime = Runtime.getRuntime(); if (committedVirtualMemorySize != null) { - Gauge.builder("system.virtualmemory.commited", operatingSystemBean, x -> invoke(committedVirtualMemorySize)) + Gauge.builder("process.virtual_memory.commited", operatingSystemBean, x -> invoke(committedVirtualMemorySize)) .tags(tags) .baseUnit(BaseUnits.BYTES) .description( From bfd66289b742337a83b439f95c24d25a05bcf189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Martins?= Date: Tue, 23 Jul 2024 18:59:21 -0300 Subject: [PATCH 5/6] Renaming of gauge to better reflect the virtual memory metric --- .../core/instrument/binder/system/MemoryMetrics.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java index 6e80114b3..4c88cba27 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/MemoryMetrics.java @@ -89,7 +89,9 @@ public MemoryMetrics(Iterable tags) { public void bindTo(MeterRegistry registry) { Runtime runtime = Runtime.getRuntime(); if (committedVirtualMemorySize != null) { - Gauge.builder("process.virtual_memory.commited", operatingSystemBean, x -> invoke(committedVirtualMemorySize)) + Gauge + .builder("process.virtual_memory.commited", operatingSystemBean, + x -> invoke(committedVirtualMemorySize)) .tags(tags) .baseUnit(BaseUnits.BYTES) .description( From e1436795ac44e2d72d4c2ff4500b696066b3bb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20C=2E=20Martins?= Date: Tue, 23 Jul 2024 19:11:43 -0300 Subject: [PATCH 6/6] Renaming of gauge to better reflect the virtual memory metric --- .../core/instrument/binder/system/MemoryMetricsTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java index 27b3a4f18..393929823 100644 --- a/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java +++ b/micrometer-core/src/test/java/io/micrometer/core/instrument/binder/system/MemoryMetricsTest.java @@ -42,7 +42,7 @@ void setup() { @Test void memoryMetrics() { - Gauge virtualMemCommited = registry.get("system.virtualmemory.commited").gauge(); + Gauge virtualMemCommited = registry.get("process.virtual_memory.commited").gauge(); assertThat(virtualMemCommited.getId().getBaseUnit()).isEqualTo(BaseUnits.BYTES); Gauge swapTotal = registry.get("system.swap.total").gauge(); @@ -64,7 +64,7 @@ void memoryMetrics() { @Test void hotspotMetrics() { assumeFalse(isOpenJ9()); - assertThat(registry.get("system.virtualmemory.commited").gauge().value()).isNotNegative(); + assertThat(registry.get("process.virtual_memory.commited").gauge().value()).isNotNegative(); assertThat(registry.get("system.memory.free").gauge().value()).isNotNegative(); } @@ -72,7 +72,7 @@ void hotspotMetrics() { void j9Metrics() { assumeTrue(isOpenJ9()); - assertThat(registry.get("system.virtualmemory.commited").gauge().value()).isGreaterThanOrEqualTo(-1); + assertThat(registry.get("process.virtual_memory.commited").gauge().value()).isGreaterThanOrEqualTo(-1); assertThat(registry.get("system.memory.free").gauge().value()).isGreaterThanOrEqualTo(-1); }