diff options
Diffstat (limited to 'cps-application/src/main/java')
-rw-r--r-- | cps-application/src/main/java/org/onap/cps/Application.java | 2 | ||||
-rw-r--r-- | cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java | 50 |
2 files changed, 33 insertions, 19 deletions
diff --git a/cps-application/src/main/java/org/onap/cps/Application.java b/cps-application/src/main/java/org/onap/cps/Application.java index 053139fcc8..62103bf368 100644 --- a/cps-application/src/main/java/org/onap/cps/Application.java +++ b/cps-application/src/main/java/org/onap/cps/Application.java @@ -22,9 +22,7 @@ package org.onap.cps; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.retry.annotation.EnableRetry;
-@EnableRetry
@SpringBootApplication
public class Application {
public static void main(final String[] args) {
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 39ed6ef5a7..b85f391b8e 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,10 +21,14 @@ 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.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -32,8 +36,8 @@ import org.springframework.context.annotation.Configuration; @RequiredArgsConstructor public class MicroMeterConfig { - private static final String TAG = "state"; - private static final String CMHANDLE_STATE_GAUGE = "cmHandlesByState"; + private static final String STATE_TAG = "state"; + private static final String CM_HANDLE_STATE_GAUGE = "cmHandlesByState"; final IMap<String, Integer> cmHandlesByState; @Bean @@ -41,6 +45,18 @@ public class MicroMeterConfig { return new TimedAspect(meterRegistry); } + @Bean + @ConditionalOnProperty("cps.monitoring.micrometer-jvm-extras") + public MeterBinder processMemoryMetrics() { + return new ProcessMemoryMetrics(); + } + + @Bean + @ConditionalOnProperty("cps.monitoring.micrometer-jvm-extras") + public MeterBinder processThreadMetrics() { + return new ProcessThreadMetrics(); + } + /** * Register gauge metric for cm handles with state 'advised'. * @@ -49,10 +65,10 @@ public class MicroMeterConfig { */ @Bean public Gauge advisedCmHandles(final MeterRegistry meterRegistry) { - return Gauge.builder(CMHANDLE_STATE_GAUGE, cmHandlesByState, + return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState, value -> cmHandlesByState.get("advisedCmHandlesCount")) - .tag(TAG, "ADVISED") - .description("Current number of cmhandles in advised state") + .tag(STATE_TAG, "ADVISED") + .description("Current number of cm handles in advised state") .register(meterRegistry); } @@ -64,10 +80,10 @@ public class MicroMeterConfig { */ @Bean public Gauge readyCmHandles(final MeterRegistry meterRegistry) { - return Gauge.builder(CMHANDLE_STATE_GAUGE, cmHandlesByState, + return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState, value -> cmHandlesByState.get("readyCmHandlesCount")) - .tag(TAG, "READY") - .description("Current number of cmhandles in ready state") + .tag(STATE_TAG, "READY") + .description("Current number of cm handles in ready state") .register(meterRegistry); } @@ -79,10 +95,10 @@ public class MicroMeterConfig { */ @Bean public Gauge lockedCmHandles(final MeterRegistry meterRegistry) { - return Gauge.builder(CMHANDLE_STATE_GAUGE, cmHandlesByState, + return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState, value -> cmHandlesByState.get("lockedCmHandlesCount")) - .tag(TAG, "LOCKED") - .description("Current number of cmhandles in locked state") + .tag(STATE_TAG, "LOCKED") + .description("Current number of cm handles in locked state") .register(meterRegistry); } @@ -94,10 +110,10 @@ public class MicroMeterConfig { */ @Bean public Gauge deletingCmHandles(final MeterRegistry meterRegistry) { - return Gauge.builder(CMHANDLE_STATE_GAUGE, cmHandlesByState, + return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState, value -> cmHandlesByState.get("deletingCmHandlesCount")) - .tag(TAG, "DELETING") - .description("Current number of cmhandles in deleting state") + .tag(STATE_TAG, "DELETING") + .description("Current number of cm handles in deleting state") .register(meterRegistry); } @@ -109,10 +125,10 @@ public class MicroMeterConfig { */ @Bean public Gauge deletedCmHandles(final MeterRegistry meterRegistry) { - return Gauge.builder(CMHANDLE_STATE_GAUGE, cmHandlesByState, + return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState, value -> cmHandlesByState.get("deletedCmHandlesCount")) - .tag(TAG, "DELETED") - .description("Current number of cmhandles in deleted state") + .tag(STATE_TAG, "DELETED") + .description("Number of cm handles that have been deleted since the application started") .register(meterRegistry); } |