summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-08-31 10:38:10 +0100
committerFrancescoFioraEst <francesco.fiora@est.tech>2022-08-31 10:51:45 +0100
commitce70bbd8090312e717e1dcde7871b58cf813cbe2 (patch)
treec14daad73db7e8fda535604125f23852191382fa
parentde9211996ad934d231c4950debc2bd49094d547b (diff)
Add Prometheus metric messages for ACM runtime
Issue-ID: POLICY-4336 Change-Id: I8f89f795625d8802ee6f3836c6fc4b66f0db75db Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java16
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java11
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java5
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java7
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java5
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java6
8 files changed, 49 insertions, 9 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java
index dca31cdb8..084f7c774 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/MetricsConfiguration.java
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.config;
+import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
@@ -33,8 +34,19 @@ public class MetricsConfiguration {
* Load up the metrics registry.
*/
@Bean
- InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor,
- MeterRegistry registry) {
+ public InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor,
+ MeterRegistry registry) {
return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, "");
}
+
+ /**
+ * Register TimedAspect.
+ *
+ * @param registry MeterRegistry
+ * @return TimedAspect
+ */
+ @Bean
+ public TimedAspect timedAspect(MeterRegistry registry) {
+ return new TimedAspect(registry);
+ }
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
index 055acb28f..6591655f6 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.runtime.supervision;
+import io.micrometer.core.annotation.Timed;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -135,6 +136,7 @@ public class SupervisionHandler {
* @param participantStatusMessage the ParticipantStatus message received from a participant
*/
@MessageIntercept
+ @Timed(value = "listener.participant_status", description = "PARTICIPANT_STATUS messages received")
public void handleParticipantMessage(ParticipantStatus participantStatusMessage) {
LOGGER.debug("Participant Status received {}", participantStatusMessage);
try {
@@ -157,6 +159,7 @@ public class SupervisionHandler {
* @param participantRegisterMessage the ParticipantRegister message received from a participant
*/
@MessageIntercept
+ @Timed(value = "listener.participant_register", description = "PARTICIPANT_REGISTER messages received")
public boolean handleParticipantMessage(ParticipantRegister participantRegisterMessage) {
LOGGER.debug("Participant Register received {}", participantRegisterMessage);
try {
@@ -179,6 +182,7 @@ public class SupervisionHandler {
* @param participantDeregisterMessage the ParticipantDeregister message received from a participant
*/
@MessageIntercept
+ @Timed(value = "listener.participant_deregister", description = "PARTICIPANT_DEREGISTER messages received")
public void handleParticipantMessage(ParticipantDeregister participantDeregisterMessage) {
LOGGER.debug("Participant Deregister received {}", participantDeregisterMessage);
try {
@@ -206,6 +210,7 @@ public class SupervisionHandler {
* @param participantUpdateAckMessage the ParticipantUpdateAck message received from a participant
*/
@MessageIntercept
+ @Timed(value = "listener.participant_update_ack", description = "PARTICIPANT_UPDATE_ACK messages received")
public void handleParticipantMessage(ParticipantUpdateAck participantUpdateAckMessage) {
LOGGER.debug("Participant Update Ack received {}", participantUpdateAckMessage);
try {
@@ -253,6 +258,8 @@ public class SupervisionHandler {
* @param automationCompositionAckMessage the AutomationCompositionAck message received from a participant
*/
@MessageIntercept
+ @Timed(value = "listener.automation_composition_update_ack",
+ description = "AUTOMATION_COMPOSITION_UPDATE_ACK messages received")
public void handleAutomationCompositionUpdateAckMessage(AutomationCompositionAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition Update Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
@@ -264,6 +271,8 @@ public class SupervisionHandler {
* @param automationCompositionAckMessage the AutomationCompositionAck message received from a participant
*/
@MessageIntercept
+ @Timed(value = "listener.automation_composition_statechange_ack",
+ description = "AUTOMATION_COMPOSITION_STATECHANGE_ACK messages received")
public void handleAutomationCompositionStateChangeAckMessage(
AutomationCompositionAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition StateChange Ack message received {}", automationCompositionAckMessage);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
index 4e0d12bf6..79b8f90c2 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import io.micrometer.core.annotation.Timed;
import java.util.UUID;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
@@ -38,6 +39,8 @@ public class AutomationCompositionStateChangePublisher
* @param automationComposition the AutomationComposition
* @param startPhase the startPhase
*/
+ @Timed(value = "publisher.automation_composition_state_change",
+ description = "AUTOMATION_COMPOSITION_STATE_CHANGE messages published")
public void send(AutomationComposition automationComposition, int startPhase) {
var acsc = new AutomationCompositionStateChange();
acsc.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
index ac5a998b4..56da7e5a4 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,6 +22,7 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import io.micrometer.core.annotation.Timed;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@@ -54,6 +55,8 @@ public class AutomationCompositionUpdatePublisher extends AbstractParticipantPub
*
* @param automationComposition the AutomationComposition
*/
+ @Timed(value = "publisher.automation_composition_update",
+ description = "AUTOMATION_COMPOSITION_UPDATE messages published")
public void send(AutomationComposition automationComposition) {
send(automationComposition, 0);
}
@@ -64,6 +67,8 @@ public class AutomationCompositionUpdatePublisher extends AbstractParticipantPub
* @param automationComposition the AutomationComposition
* @param startPhase the Start Phase
*/
+ @Timed(value = "publisher.automation_composition_update",
+ description = "AUTOMATION_COMPOSITION_UPDATE messages published")
public void send(AutomationComposition automationComposition, int startPhase) {
var automationCompositionUpdateMsg = new AutomationCompositionUpdate();
automationCompositionUpdateMsg.setStartPhase(startPhase);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
index 34881b557..1b2edf715 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterAckPublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import io.micrometer.core.annotation.Timed;
import java.util.UUID;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.springframework.stereotype.Component;
@@ -35,6 +36,8 @@ public class ParticipantDeregisterAckPublisher extends AbstractParticipantAckPub
*
* @param responseTo the original request id in the request.
*/
+ @Timed(value = "publisher.participant_deregister_ack",
+ description = "PARTICIPANT_DEREGISTER_ACK messages published")
public void send(UUID responseTo) {
var message = new ParticipantDeregisterAck();
message.setResponseTo(responseTo);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
index 8344837c1..bd8f2b560 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import io.micrometer.core.annotation.Timed;
import java.util.UUID;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -38,6 +39,7 @@ public class ParticipantRegisterAckPublisher extends AbstractParticipantAckPubli
* @param participantId the participant Id
* @param participantType the participant Type
*/
+ @Timed(value = "publisher.participant_register_ack", description = "PARTICIPANT_REGISTER_ACK messages published")
public void send(UUID responseTo, ToscaConceptIdentifier participantId, ToscaConceptIdentifier participantType) {
var message = new ParticipantRegisterAck();
message.setParticipantId(participantId);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
index 0de8ff063..d1f183ee8 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import io.micrometer.core.annotation.Timed;
import java.time.Instant;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -37,6 +38,7 @@ public class ParticipantStatusReqPublisher extends AbstractParticipantPublisher<
*
* @param participantId the participant Id
*/
+ @Timed(value = "publisher.participant_status_req", description = "PARTICIPANT_STATUS_REQ messages published")
public void send(ToscaConceptIdentifier participantId) {
ParticipantStatusReq message = new ParticipantStatusReq();
message.setParticipantId(participantId);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
index 47a66c10e..27e8156b0 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,6 +22,7 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import io.micrometer.core.annotation.Timed;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@@ -57,6 +58,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
* @param name the ToscaServiceTemplate name
* @param version the ToscaServiceTemplate version
*/
+ @Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public void sendComissioningBroadcast(String name, String version) {
sendCommissioning(name, version, null, null);
}
@@ -70,6 +72,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
* @param participantType the ParticipantType
* @param participantId the ParticipantId
*/
+ @Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public boolean sendCommissioning(String name, String version, ToscaConceptIdentifier participantType,
ToscaConceptIdentifier participantId) {
var message = new ParticipantUpdate();
@@ -115,6 +118,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
/**
* Send ParticipantUpdate to Participant after that commissioning has been removed.
*/
+ @Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public void sendDecomisioning() {
var message = new ParticipantUpdate();
message.setTimestamp(Instant.now());