From 6f9ecc5cfc8ca48df55e4893b403e0d75f4cfc07 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Thu, 23 Jan 2025 15:07:06 +0000 Subject: Expose JVM process metrics Currently, Grafana only shows memory used inside the JVM, but not including memory used by the JVM process itself. These metrics are needed for determining real memory usage. Issue-ID: CPS-2583 Signed-off-by: danielhanrahan Change-Id: Ib77f9057c7301ea5afc2a621526736213ddd817a --- .../src/main/java/org/onap/cps/config/MicroMeterConfig.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cps-application/src/main/java/org/onap') diff --git a/cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java b/cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java index d169c61ad6..8481eadf1b 100644 --- a/cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java +++ b/cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java @@ -21,9 +21,12 @@ package org.onap.cps.config; import com.hazelcast.map.IMap; +import io.github.mweirauch.micrometer.jvm.extras.ProcessMemoryMetrics; +import io.github.mweirauch.micrometer.jvm.extras.ProcessThreadMetrics; import io.micrometer.core.aop.TimedAspect; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.MeterBinder; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -41,6 +44,16 @@ public class MicroMeterConfig { return new TimedAspect(meterRegistry); } + @Bean + public MeterBinder processMemoryMetrics() { + return new ProcessMemoryMetrics(); + } + + @Bean + public MeterBinder processThreadMetrics() { + return new ProcessThreadMetrics(); + } + /** * Register gauge metric for cm handles with state 'advised'. * -- cgit 1.2.3-korg