aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cps-application/pom.xml4
-rw-r--r--cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java13
-rw-r--r--cps-application/src/test/groovy/org/onap/cps/config/MicroMeterConfigSpec.groovy9
-rw-r--r--cps-dependencies/pom.xml5
4 files changed, 30 insertions, 1 deletions
diff --git a/cps-application/pom.xml b/cps-application/pom.xml
index 5ac2202e85..1a46b5fa8a 100644
--- a/cps-application/pom.xml
+++ b/cps-application/pom.xml
@@ -78,6 +78,10 @@
<artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
<dependency>
+ <groupId>io.github.mweirauch</groupId>
+ <artifactId>micrometer-jvm-extras</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
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'.
*
diff --git a/cps-application/src/test/groovy/org/onap/cps/config/MicroMeterConfigSpec.groovy b/cps-application/src/test/groovy/org/onap/cps/config/MicroMeterConfigSpec.groovy
index fc8c670ebf..b9302ccd72 100644
--- a/cps-application/src/test/groovy/org/onap/cps/config/MicroMeterConfigSpec.groovy
+++ b/cps-application/src/test/groovy/org/onap/cps/config/MicroMeterConfigSpec.groovy
@@ -31,10 +31,17 @@ class MicroMeterConfigSpec extends Specification {
def simpleMeterRegistry = new SimpleMeterRegistry()
def 'Creating a timed aspect.'() {
- expect: ' a timed aspect can be created'
+ expect: 'a timed aspect can be created'
assert objectUnderTest.timedAspect(simpleMeterRegistry) != null
}
+ def 'Creating JVM process metrics.'() {
+ expect: 'process memory metrics can be created'
+ assert objectUnderTest.processMemoryMetrics() != null
+ and: 'process thread metrics can be created'
+ assert objectUnderTest.processThreadMetrics() != null
+ }
+
def 'Creating gauges for cm handle states.'() {
given: 'cache returns value for each state'
cmHandlesByState.get(_) >> 1
diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml
index bf9ba00937..62fa154611 100644
--- a/cps-dependencies/pom.xml
+++ b/cps-dependencies/pom.xml
@@ -173,6 +173,11 @@
<scope>import</scope>
</dependency>
<dependency>
+ <groupId>io.github.mweirauch</groupId>
+ <artifactId>micrometer-jvm-extras</artifactId>
+ <version>0.2.2</version>
+ </dependency>
+ <dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.9.0</version>