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;
* 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);
+ }
}
/*-
* ============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");
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;
* @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 {
* @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 {
* @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 {
* @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 {
* @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);
* @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);
/*-
* ============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.
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;
* @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());
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
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;
*
* @param automationComposition the AutomationComposition
*/
+ @Timed(value = "publisher.automation_composition_update",
+ description = "AUTOMATION_COMPOSITION_UPDATE messages published")
public void send(AutomationComposition automationComposition) {
send(automationComposition, 0);
}
* @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);
/*-
* ============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.
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;
*
* @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);
/*-
* ============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.
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;
* @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);
/*-
* ============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.
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;
*
* @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);
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2022 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
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;
* @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);
}
* @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();
/**
* 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());