diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2022-10-26 16:29:50 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2022-10-28 07:51:45 +0000 |
commit | 6cec34379cf6f1ca1ff69cd2c8973937d896aa62 (patch) | |
tree | 5b6f1de4da2e5f974757a74ecd351dfd657d85c6 /participant/participant-intermediary/src/main/java | |
parent | 75a69e67d03a55d3961d0f6a9f7925868dd39aa6 (diff) |
Remove old implementation of statistics in ACM participants
The old implementation of statistics in ACM-participants
can be removed due the Prometheus metrics support.
Issue-ID: POLICY-4420
Change-Id: I0785b269614aba51f94e71a3fe931541c1918b0c
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src/main/java')
5 files changed, 5 insertions, 129 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java index 9affd5751..f2832c5b5 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.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. @@ -54,12 +54,4 @@ public interface AutomationCompositionElementListener { public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId, AutomationCompositionElement element, ToscaNodeTemplate automationCompositionElementDefinition) throws PfModelException; - - /** - * Handle automationCompositionElement statistics. - * - * @param automationCompositionElementId automationCompositionElement id - * @throws PfModelException in case of a model exception - */ - public void handleStatistics(UUID automationCompositionElementId) throws PfModelException; } diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java index 79f5259bf..754a8305f 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.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"); @@ -24,14 +24,12 @@ package org.onap.policy.clamp.acm.participant.intermediary.api; import java.util.List; import java.util.Map; import java.util.UUID; -import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; import org.onap.policy.clamp.models.acm.concepts.Participant; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; @@ -76,13 +74,6 @@ public interface ParticipantIntermediaryApi { Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state); /** - * Update the statistics of a participant. - * - * @param participantStatistics the statistics of the participant - */ - void updateParticipantStatistics(ParticipantStatistics participantStatistics); - - /** * Get automation compositions from the intermediary API. * * @param name the automation composition element name, null for all @@ -119,12 +110,4 @@ public interface ParticipantIntermediaryApi { AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState, ParticipantMessageType messageType); - - /** - * Update the automation composition element statistics. - * - * @param id the ID of the automation composition element to update the state on - * @param elementStatistics the updated statistics - */ - void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics); } diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java index 1a1f8500f..e4d921af7 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.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"); @@ -29,7 +29,6 @@ import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationComposit import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi; import org.onap.policy.clamp.acm.participant.intermediary.handler.AutomationCompositionHandler; import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler; -import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; @@ -37,7 +36,6 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; import org.onap.policy.clamp.models.acm.concepts.Participant; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; @@ -89,11 +87,6 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp } @Override - public void updateParticipantStatistics(ParticipantStatistics participantStatistics) { - participantHandler.updateParticipantStatistics(participantStatistics); - } - - @Override public AutomationCompositions getAutomationCompositions(String name, String version) { return automationCompositionHandler.getAutomationCompositions(); } @@ -132,9 +125,4 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp return automationCompositionHandler.updateAutomationCompositionElementState(automationCompositionId, id, currentState, newState); } - - @Override - public void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics) { - automationCompositionHandler.updateAutomationCompositionElementStatistics(id, elementStatistics); - } } diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java index 7e1fb5443..4c74e50fe 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.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"); @@ -32,7 +32,6 @@ import lombok.Getter; import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener; import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters; -import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck; @@ -147,21 +146,6 @@ public class AutomationCompositionHandler { } /** - * Handle a automation composition element statistics. - * - * @param id automation composition element id - * @param elementStatistics automation composition element Statistics - */ - public void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics) { - var acElement = elementsOnThisParticipant.get(id); - if (acElement != null) { - elementStatistics.setParticipantId(participantId); - elementStatistics.setId(id); - acElement.setAcElementStatistics(elementStatistics); - } - } - - /** * Handle a automation composition state change message. * * @param stateChangeMsg the state change message diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java index fa02f3dcf..3362f10d3 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.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,31 +22,22 @@ package org.onap.policy.clamp.acm.participant.intermediary.handler; -import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.UUID; -import java.util.stream.Collectors; import lombok.Getter; import lombok.Setter; -import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener; import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters; -import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList; -import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionStatistics; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; import org.onap.policy.clamp.models.acm.concepts.Participant; import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage; @@ -59,7 +50,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantSt import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; -import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; import org.slf4j.Logger; @@ -80,7 +70,6 @@ public class ParticipantHandler { private final ToscaConceptIdentifier participantId; private final AutomationCompositionHandler automationCompositionHandler; - private final ParticipantStatistics participantStatistics; private final ParticipantMessagePublisher publisher; @Setter @@ -103,11 +92,6 @@ public class ParticipantHandler { this.participantId = parameters.getIntermediaryParameters().getParticipantId(); this.publisher = publisher; this.automationCompositionHandler = automationCompositionHandler; - this.participantStatistics = new ParticipantStatistics(); - this.participantStatistics.setParticipantId(participantId); - this.participantStatistics.setState(state); - this.participantStatistics.setHealthStatus(healthStatus); - this.participantStatistics.setTimeStamp(Instant.now()); } /** @@ -121,29 +105,6 @@ public class ParticipantHandler { } /** - * Update AutomationCompositionElement statistics. The automation composition elements listening will be - * notified to retrieve statistics from respective automation composition elements, and automation - * compositionelements - * data on the handler will be updated. - * - * @param automationCompositions the automation compositions - * @param acElementListener automation composition element listener - */ - private void updateAcElementStatistics(AutomationCompositions automationCompositions, - AutomationCompositionElementListener acElementListener) { - for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) { - for (AutomationCompositionElement element : automationComposition.getElements().values()) { - try { - acElementListener.handleStatistics(element.getId()); - } catch (PfModelException e) { - LOGGER.debug("Getting statistics for automation composition element failed for element ID {}", - element.getId(), e); - } - } - } - } - - /** * Handle a automation composition update message. * * @param updateMsg the update message @@ -193,19 +154,6 @@ public class ParticipantHandler { } /** - * Method to update participant statistics. - * - * @param statistics participant statistics - */ - public void updateParticipantStatistics(ParticipantStatistics statistics) { - participantStatistics.setState(statistics.getState()); - participantStatistics.setHealthStatus(statistics.getHealthStatus()); - participantStatistics.setTimeStamp(statistics.getTimeStamp()); - participantStatistics.setAverageExecutionTime(statistics.getAverageExecutionTime()); - participantStatistics.setEventCount(statistics.getEventCount()); - } - - /** * Get participants as a {@link Participant} class. * * @param name the participant name to get @@ -366,19 +314,8 @@ public class ParticipantHandler { * Method to send heartbeat to automation composition runtime. */ public ParticipantStatus makeHeartbeat(boolean responseToParticipantStatusReq) { - if (!responseToParticipantStatusReq) { - var automationCompositions = automationCompositionHandler.getAutomationCompositions(); - for (var acElementListener : automationCompositionHandler.getListeners()) { - updateAcElementStatistics(automationCompositions, acElementListener); - } - } - this.participantStatistics.setState(state); - this.participantStatistics.setHealthStatus(healthStatus); - this.participantStatistics.setTimeStamp(Instant.now()); - var heartbeat = new ParticipantStatus(); heartbeat.setParticipantId(participantId); - heartbeat.setParticipantStatistics(participantStatistics); heartbeat.setParticipantType(participantType); heartbeat.setHealthStatus(healthStatus); heartbeat.setState(state); @@ -400,14 +337,6 @@ public class ParticipantHandler { for (var entry : automationCompositionHandler.getAutomationCompositionMap().entrySet()) { var acInfo = new AutomationCompositionInfo(); acInfo.setAutomationCompositionId(entry.getKey()); - var acStatitistics = new AutomationCompositionStatistics(); - acStatitistics.setAutomationCompositionId(entry.getKey()); - var acElementStatisticsList = new AcElementStatisticsList(); - acElementStatisticsList.setAcElementStatistics(entry.getValue().getElements().values().stream() - .map(AutomationCompositionElement::getAcElementStatistics).filter(Objects::nonNull) - .collect(Collectors.toList())); - acStatitistics.setAcElementStatisticsList(acElementStatisticsList); - acInfo.setAutomationCompositionStatistics(acStatitistics); acInfo.setState(entry.getValue().getState()); automationCompositionInfoList.add(acInfo); } |