aboutsummaryrefslogtreecommitdiffstats
path: root/cps-application/src
diff options
context:
space:
mode:
Diffstat (limited to 'cps-application/src')
-rw-r--r--cps-application/src/main/java/org/onap/cps/Application.java2
-rw-r--r--cps-application/src/main/java/org/onap/cps/config/MicroMeterConfig.java50
-rw-r--r--cps-application/src/main/resources/application.yml7
-rw-r--r--cps-application/src/test/groovy/org/onap/cps/config/MicroMeterConfigSpec.groovy14
-rw-r--r--cps-application/src/test/java/org/onap/cps/architecture/ArchitectureTestBase.java1
-rw-r--r--cps-application/src/test/java/org/onap/cps/architecture/CpsArchitectureTest.java6
6 files changed, 52 insertions, 28 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);
}
diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml
index 573db1fb10..6b9c694cf2 100644
--- a/cps-application/src/main/resources/application.yml
+++ b/cps-application/src/main/resources/application.yml
@@ -152,6 +152,8 @@ security:
password: ${CPS_PASSWORD:cpsr0cks!}
cps:
+ monitoring:
+ micrometer-jvm-extras: false
tracing:
sampler:
jaeger_remote:
@@ -172,7 +174,7 @@ management:
endpoints:
web:
exposure:
- include: info,health,loggers,prometheus,metrics
+ include: info,health,loggers,prometheus,metrics,heapdump,threaddump
endpoint:
health:
show-details: always
@@ -207,6 +209,7 @@ ncmp:
connectionTimeoutInSeconds: 30
readTimeoutInSeconds: 30
writeTimeoutInSeconds: 30
+ responseTimeoutInSeconds: 60
dmi:
httpclient:
data-services:
@@ -216,6 +219,7 @@ ncmp:
connectionTimeoutInSeconds: 30
readTimeoutInSeconds: 30
writeTimeoutInSeconds: 30
+ responseTimeoutInSeconds: 60
model-services:
maximumInMemorySizeInMegabytes: 16
maximumConnectionsTotal: 100
@@ -223,6 +227,7 @@ ncmp:
connectionTimeoutInSeconds: 30
readTimeoutInSeconds: 30
writeTimeoutInSeconds: 30
+ responseTimeoutInSeconds: 60
auth:
username: ${DMI_USERNAME:cpsuser}
password: ${DMI_PASSWORD:cpsr0cks!}
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 67ca64624a..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
@@ -45,9 +52,8 @@ class MicroMeterConfigSpec extends Specification {
objectUnderTest.deletingCmHandles(simpleMeterRegistry)
objectUnderTest.deletedCmHandles(simpleMeterRegistry)
then: 'each state has the correct value when queried'
- def states = ["ADVISED", "READY", "LOCKED", "DELETING", "DELETED"]
- states.each { state ->
- def gaugeValue = simpleMeterRegistry.get("cmHandlesByState").tag("state",state).gauge().value()
+ ['ADVISED', 'READY', 'LOCKED', 'DELETING', 'DELETED'].each { state ->
+ def gaugeValue = simpleMeterRegistry.get('cmHandlesByState').tag('state',state).gauge().value()
assert gaugeValue == 1
}
}
diff --git a/cps-application/src/test/java/org/onap/cps/architecture/ArchitectureTestBase.java b/cps-application/src/test/java/org/onap/cps/architecture/ArchitectureTestBase.java
index 1d39060024..c1d65758c7 100644
--- a/cps-application/src/test/java/org/onap/cps/architecture/ArchitectureTestBase.java
+++ b/cps-application/src/test/java/org/onap/cps/architecture/ArchitectureTestBase.java
@@ -36,6 +36,7 @@ public class ArchitectureTestBase {
"lombok..",
"org.apache..",
"org.mapstruct..",
+ "org.opendaylight..",
"org.slf4j..",
"org.springframework..",
"reactor.."
diff --git a/cps-application/src/test/java/org/onap/cps/architecture/CpsArchitectureTest.java b/cps-application/src/test/java/org/onap/cps/architecture/CpsArchitectureTest.java
index e68343b364..06ca632f36 100644
--- a/cps-application/src/test/java/org/onap/cps/architecture/CpsArchitectureTest.java
+++ b/cps-application/src/test/java/org/onap/cps/architecture/CpsArchitectureTest.java
@@ -43,11 +43,9 @@ public class CpsArchitectureTest extends ArchitectureTestBase {
@ArchTest
static final ArchRule cpsServiceImplShouldDependOnServiceAndEventsAndPathParserPackages =
- // I think impl package should be moved from the api package.
- // So in a way this whole rule is breaking our architecture goals
- classes().that().resideInAPackage("org.onap.cps.api.impl..").should().onlyDependOnClassesThat()
+ classes().that().resideInAPackage("org.onap.cps.impl..").should().onlyDependOnClassesThat()
.resideInAnyPackage(commonAndListedPackages("org.onap.cps.api..",
- "org.onap.cps.api.impl..",
+ "org.onap.cps.impl..",
"org.onap.cps.events..",
"org.onap.cps.impl.utils..",
"org.onap.cps.spi..",