summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main/java/org/onap
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-10-26 14:34:46 +0100
committerFrancescoFioraEst <francesco.fiora@est.tech>2022-10-27 12:53:12 +0100
commit9082093f00a3f21b2f824251c5ce60b775ad312c (patch)
tree3c7321f71bc742982a5011012d140c4beebde1db /runtime-acm/src/main/java/org/onap
parent75a69e67d03a55d3961d0f6a9f7925868dd39aa6 (diff)
Remove old implementation of statistics in ACM-runtime
The old implementation of statistics in ACM-runtime can be removed due the Prometheus metrics support. Issue-ID: POLICY-4419 Change-Id: Idecad04b4a5dd32ce2ebc1149eb99e4fdc6f0db1 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/main/java/org/onap')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java334
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java247
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java30
4 files changed, 3 insertions, 614 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java
index 94c8bce06..0918cea1c 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SpringFoxConfig.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,7 +20,7 @@
package org.onap.policy.clamp.acm.runtime.config;
-import org.onap.policy.clamp.acm.runtime.main.rest.MonitoringQueryController;
+import org.onap.policy.clamp.acm.runtime.main.rest.CommissioningController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
@@ -39,7 +39,7 @@ public class SpringFoxConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select()
- .apis(RequestHandlerSelectors.basePackage(MonitoringQueryController.class.getPackageName()))
+ .apis(RequestHandlerSelectors.basePackage(CommissioningController.class.getPackageName()))
.paths(PathSelectors.any()).build();
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java
deleted file mode 100644
index 30c1d5dc9..000000000
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/MonitoringQueryController.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.runtime.main.rest;
-
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import io.swagger.annotations.Authorization;
-import io.swagger.annotations.Extension;
-import io.swagger.annotations.ExtensionProperty;
-import io.swagger.annotations.ResponseHeader;
-import java.time.Instant;
-import java.util.UUID;
-import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.acm.runtime.main.web.AbstractRestController;
-import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
-import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
-import org.onap.policy.models.base.PfModelException;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * This class handles REST endpoints for ACM Statistics monitoring.
- */
-@RestController
-@RequiredArgsConstructor
-public class MonitoringQueryController extends AbstractRestController {
-
- private static final String TAGS = "Clamp Automation Composition Monitoring API";
- private final MonitoringProvider provider;
-
- /**
- * Queries details of automation composition participants statistics.
- *
- * @param requestId request ID used in ONAP logging
- * @param name the name of the participant to get, null for all participants statistics
- * @param version the version of the participant to get, null for all participants with the given name
- * @param recordCount the record count to be fetched
- * @param startTime the time from which to get statistics
- * @param endTime the time to which to get statistics
- * @return the participant statistics
- */
- // @formatter:off
- @GetMapping(value = "/monitoring/participant",
- produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested participant stats",
- notes = "Queries details of the requested participant stats, returning all participant stats",
- response = ParticipantStatisticsList.class,
- tags = {TAGS},
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<ParticipantStatisticsList> queryParticipantStatistics(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Automation composition participant name") @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Automation composition participant version", required = false) @RequestParam(
- value = "version",
- required = false) final String version,
- @ApiParam(value = "Record count", required = false) @RequestParam(
- value = "recordCount",
- required = false,
- defaultValue = "0") final int recordCount,
- @ApiParam(value = "start time", required = false) @RequestParam(
- value = "startTime",
- required = false) final String startTime,
- @ApiParam(value = "end time", required = false) @RequestParam(
- value = "endTime",
- required = false) final String endTime) {
-
- Instant startTimestamp = null;
- Instant endTimestamp = null;
-
- if (startTime != null) {
- startTimestamp = Instant.parse(startTime);
- }
- if (endTime != null) {
- endTimestamp = Instant.parse(endTime);
- }
- return ResponseEntity.ok().body(
- provider.fetchFilteredParticipantStatistics(name, version, recordCount, startTimestamp, endTimestamp));
- }
-
- /**
- * Queries details of all participant statistics per automation composition.
- *
- * @param requestId request ID used in ONAP logging
- * @param name the name of the automation composition
- * @param version version of the automation composition
- * @return the automation composition element statistics
- */
- // @formatter:off
- @GetMapping(value = "/monitoring/participants/automationcomposition",
- produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of all the participant stats in a automation composition",
- notes = "Queries details of the participant stats, returning all participant stats",
- response = AcElementStatisticsList.class,
- tags = {TAGS},
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- })
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<ParticipantStatisticsList> queryParticipantStatisticsPerAutomationComposition(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Automation composition name", required = true) @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Automation composition version", required = true) @RequestParam(
- value = "version",
- required = false) final String version) {
-
- return ResponseEntity.ok().body(provider.fetchParticipantStatsPerAutomationComposition(name, version));
- }
-
- /**
- * Queries details of all automation composition element statistics per automation composition.
- *
- * @param requestId request ID used in ONAP logging
- * @param name the name of the automation composition
- * @param version version of the automation composition
- * @return the automation composition element statistics
- */
- // @formatter:off
- @GetMapping(value = "/monitoring/acelements/automationcomposition",
- produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested acElement stats in a automation composition",
- notes = "Queries details of the requested acElement stats, returning all acElement stats",
- response = AcElementStatisticsList.class,
- tags = {TAGS},
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- })
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<AcElementStatisticsList> queryElementStatisticsPerAutomationComposition(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Automation composition name", required = true) @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Automation composition version", required = true) @RequestParam(
- value = "version",
- required = false) final String version) {
-
- return ResponseEntity.ok().body(provider.fetchAcElementStatsPerAutomationComposition(name, version));
- }
-
- /**
- * Queries details of all automation composition element statistics per automation composition.
- *
- * @param requestId request ID used in ONAP logging
- * @param name the name of the automation composition
- * @param version version of the automation composition
- * @param id Id of the automation composition element
- * @param recordCount the record count to be fetched
- * @param startTime the time from which to get statistics
- * @param endTime the time to which to get statistics
- * @return the automation composition element statistics
- * @throws PfModelException on errors getting details of all automation composition element statistics per
- * automation composition
- */
- // @formatter:off
- @GetMapping(value = "/monitoring/acelement",
- produces = {MediaType.APPLICATION_JSON_VALUE, APPLICATION_YAML})
- @ApiOperation(value = "Query details of the requested acElement stats",
- notes = "Queries details of the requested acElement stats, returning all acElement stats",
- response = AcElementStatisticsList.class,
- tags = {TAGS},
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- })
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<AcElementStatisticsList> queryElementStatistics(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Participant name", required = true) @RequestParam(
- value = "name",
- required = false) final String name,
- @ApiParam(value = "Participant version", required = true) @RequestParam(
- value = "version",
- required = false) final String version,
- @ApiParam(value = "Record count", required = false) @RequestParam(
- value = "recordCount",
- required = false,
- defaultValue = "0") final int recordCount,
- @ApiParam(value = "Automation composition element id", required = false) @RequestParam(
- value = "id",
- required = false) final String id,
- @ApiParam(value = "start time", required = false) @RequestParam(
- value = "startTime",
- required = false) final String startTime,
- @ApiParam(value = "end time", required = false) @RequestParam(
- value = "endTime",
- required = false) final String endTime)
- throws PfModelException {
-
- Instant startTimestamp = null;
- Instant endTimestamp = null;
-
- if (startTime != null) {
- startTimestamp = Instant.parse(startTime);
- }
- if (endTime != null) {
- endTimestamp = Instant.parse(endTime);
- }
- return ResponseEntity.ok().body(
- provider.fetchFilteredAcElementStatistics(name, version, id, startTimestamp, endTimestamp, recordCount));
- }
-
-}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java
deleted file mode 100644
index 2950ad9da..000000000
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/monitoring/MonitoringProvider.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.runtime.monitoring;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.AllArgsConstructor;
-import lombok.NonNull;
-import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
-import org.onap.policy.clamp.models.acm.concepts.AcElementStatisticsList;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantStatisticsList;
-import org.onap.policy.clamp.models.acm.persistence.provider.AcElementStatisticsProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantStatisticsProvider;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * This class provides information about statistics data of Automation Composition elements and Participants in database
- * to callers.
- */
-@Service
-@Transactional
-@AllArgsConstructor
-public class MonitoringProvider {
-
- private static final String DESC_ORDER = "DESC";
- private final ParticipantStatisticsProvider participantStatisticsProvider;
- private final AcElementStatisticsProvider acElementStatisticsProvider;
- private final AutomationCompositionProvider automationCompositionProvider;
-
- /**
- * Create participant statistics.
- *
- * @param participantStatistics the participant statistics
- * @return the result of create operation
- * @throws PfModelException on creation errors
- */
- public ParticipantStatisticsList createParticipantStatistics(List<ParticipantStatistics> participantStatistics)
- throws PfModelException {
- var participantStatisticsList = new ParticipantStatisticsList();
- participantStatisticsList
- .setStatisticsList(participantStatisticsProvider.createParticipantStatistics(participantStatistics));
-
- return participantStatisticsList;
- }
-
- /**
- * Create AcElement statistics.
- *
- * @param acElementStatisticsList the AcElement statistics
- * @return the result of create operation
- * @throws PfModelException on creation errors
- */
- public AcElementStatisticsList createAcElementStatistics(List<AcElementStatistics> acElementStatisticsList)
- throws PfModelException {
- var elementStatisticsList = new AcElementStatisticsList();
- elementStatisticsList
- .setAcElementStatistics(acElementStatisticsProvider.createAcElementStatistics(acElementStatisticsList));
-
- return elementStatisticsList;
- }
-
- /**
- * Get participant statistics based on specific filters.
- *
- * @param name the name of the participant statistics to get, null to get all statistics
- * @param version the version of the participant statistics to get, null to get all statistics
- * @param recordCount number of records to be fetched.
- * @param startTime start of the timestamp, from statistics to be filtered
- * @param endTime end of the timestamp up to which statistics to be filtered
- * @return the participant found
- */
- @Transactional(readOnly = true)
- public ParticipantStatisticsList fetchFilteredParticipantStatistics(@NonNull final String name,
- final String version, int recordCount, Instant startTime, Instant endTime) {
- var participantStatisticsList = new ParticipantStatisticsList();
-
- // Additional parameters can be added in filterMap for filtering data.
- Map<String, Object> filterMap = null;
- participantStatisticsList.setStatisticsList(participantStatisticsProvider.getFilteredParticipantStatistics(name,
- version, startTime, endTime, filterMap, DESC_ORDER, recordCount));
-
- return participantStatisticsList;
- }
-
- /**
- * Get all participant statistics records found for a specific automation composition.
- *
- * @param automationCompositionName name of the automation composition
- * @param automationCompositionVersion version of the automation composition
- * @return All the participant statistics found
- * @throws PfModelRuntimeException on errors getting participant statistics
- */
- @Transactional(readOnly = true)
- public ParticipantStatisticsList fetchParticipantStatsPerAutomationComposition(
- @NonNull final String automationCompositionName, @NonNull final String automationCompositionVersion) {
- var statisticsList = new ParticipantStatisticsList();
- List<ParticipantStatistics> participantStatistics = new ArrayList<>();
- try {
- // Fetch all participantIds for a specific automation composition
- List<ToscaConceptIdentifier> participantIds =
- getAllParticipantIdsPerAutomationComposition(automationCompositionName, automationCompositionVersion);
- for (ToscaConceptIdentifier id : participantIds) {
- participantStatistics.addAll(participantStatisticsProvider
- .getFilteredParticipantStatistics(id.getName(), id.getVersion(), null, null, null, DESC_ORDER, 0));
- }
- statisticsList.setStatisticsList(participantStatistics);
- } catch (PfModelException e) {
- throw new PfModelRuntimeException(e);
- }
- return statisticsList;
- }
-
- /**
- * Get AcElement statistics based on specific filters.
- *
- * @param name the name of the AcElement statistics to get, null to get all statistics
- * @param version the version of the AcElement statistics to get, null to get all statistics
- * @param id UUID of the automation composition element
- * @param startTime start of the timestamp, from statistics to be filtered
- * @param endTime end of the timestamp up to which statistics to be filtered
- * @param recordCount number of records to be fetched.
- * @return the participant found
- * @throws PfModelException on errors getting automation composition statistics
- */
- @Transactional(readOnly = true)
- public AcElementStatisticsList fetchFilteredAcElementStatistics(@NonNull final String name, final String version,
- final String id, Instant startTime, Instant endTime, int recordCount) throws PfModelException {
- var acElementStatisticsList = new AcElementStatisticsList();
- Map<String, Object> filterMap = new HashMap<>();
- // Adding UUID in filter if present
- if (id != null) {
- filterMap.put("localName", id);
- }
- acElementStatisticsList.setAcElementStatistics(acElementStatisticsProvider.getFilteredAcElementStatistics(name,
- version, startTime, endTime, filterMap, DESC_ORDER, recordCount));
-
- return acElementStatisticsList;
- }
-
- /**
- * Get AcElement statistics per automation composition.
- *
- * @param name the name of the automation composition
- * @param version the version of the automation composition
- * @return the AcElement statistics found
- * @throws PfModelRuntimeException on errors getting automation composition statistics
- */
- @Transactional(readOnly = true)
- public AcElementStatisticsList fetchAcElementStatsPerAutomationComposition(@NonNull final String name,
- @NonNull final String version) {
- var acElementStatisticsList = new AcElementStatisticsList();
- List<AcElementStatistics> acElementStats = new ArrayList<>();
- try {
- List<AutomationCompositionElement> acElements = new ArrayList<>();
- // Fetch all automation composition elements for the automation composition
- var automationCompositionOpt =
- automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version));
- if (automationCompositionOpt.isPresent()) {
- acElements.addAll(automationCompositionOpt.get().getElements().values());
- // Collect automation composition element statistics for each acElement.
- for (AutomationCompositionElement acElement : acElements) {
- acElementStats.addAll(fetchFilteredAcElementStatistics(acElement.getParticipantId().getName(),
- acElement.getParticipantId().getVersion(), acElement.getId().toString(), null, null, 0)
- .getAcElementStatistics());
- }
- }
- acElementStatisticsList.setAcElementStatistics(acElementStats);
- } catch (PfModelException e) {
- throw new PfModelRuntimeException(e);
- }
- return acElementStatisticsList;
- }
-
- /**
- * If required, REST end point can be defined for this method to fetch associated participant Ids
- * for a automation composition.
- *
- * @param name the name of the automation composition
- * @param version the version of the automation composition
- * @return List of participant Id
- * @throws PfModelException on errors
- */
- @Transactional(readOnly = true)
- public List<ToscaConceptIdentifier> getAllParticipantIdsPerAutomationComposition(String name, String version)
- throws PfModelException {
- List<ToscaConceptIdentifier> participantIds = new ArrayList<>();
- var automationCompositionOpt =
- automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version));
- if (automationCompositionOpt.isPresent()) {
- for (AutomationCompositionElement acElement : automationCompositionOpt.get().getElements().values()) {
- participantIds.add(acElement.getParticipantId());
- }
- }
- return participantIds;
- }
-
- /**
- * If required, REST end point can be defined for this method to fetch associated automation composition element Ids
- * for a automation composition.
- *
- * @param name the name of the automation composition
- * @param version the version of the automation composition
- * @return Map of automation composition Id and participant details
- * @throws PfModelException on errors
- */
- @Transactional(readOnly = true)
- public Map<String, ToscaConceptIdentifier> getAllAcElementsIdPerAutomationComposition(String name, String version)
- throws PfModelException {
- Map<String, ToscaConceptIdentifier> acElementId = new HashMap<>();
- var automationCompositionOpt =
- automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version));
- if (automationCompositionOpt.isPresent()) {
- for (AutomationCompositionElement acElement : automationCompositionOpt.get().getElements().values()) {
- acElementId.put(acElement.getId().toString(), acElement.getParticipantId());
- }
- }
- return acElementId;
- }
-}
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 6591655f6..219383ac5 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
@@ -30,7 +30,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
-import org.onap.policy.clamp.acm.runtime.monitoring.MonitoringProvider;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
@@ -39,7 +38,6 @@ import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePubli
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
@@ -83,7 +81,6 @@ public class SupervisionHandler {
private final AutomationCompositionProvider automationCompositionProvider;
private final ParticipantProvider participantProvider;
- private final MonitoringProvider monitoringProvider;
private final ServiceTemplateProvider serviceTemplateProvider;
// Publishers for participant communication
@@ -143,13 +140,6 @@ public class SupervisionHandler {
superviseParticipant(participantStatusMessage);
} catch (PfModelException | AutomationCompositionException svExc) {
LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc);
- return;
- }
-
- try {
- superviseAutomationCompositions(participantStatusMessage);
- } catch (PfModelException | AutomationCompositionException svExc) {
- LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc);
}
}
@@ -499,26 +489,6 @@ public class SupervisionHandler {
checkParticipant(participantStatusMessage, participantStatusMessage.getState(),
participantStatusMessage.getHealthStatus());
-
- monitoringProvider.createParticipantStatistics(List.of(participantStatusMessage.getParticipantStatistics()));
- }
-
- private void superviseAutomationCompositions(ParticipantStatus participantStatusMessage)
- throws PfModelException, AutomationCompositionException {
- if (participantStatusMessage.getAutomationCompositionInfoList() != null) {
- for (AutomationCompositionInfo acEntry : participantStatusMessage.getAutomationCompositionInfoList()) {
- var dbAutomationComposition = automationCompositionProvider
- .getAutomationComposition(new ToscaConceptIdentifier(acEntry.getAutomationCompositionId()));
- if (dbAutomationComposition == null) {
- exceptionOccured(Response.Status.NOT_FOUND,
- "PARTICIPANT_STATUS automation composition not found in database: "
- + acEntry.getAutomationCompositionId());
- }
- dbAutomationComposition.setState(acEntry.getState());
- monitoringProvider.createAcElementStatistics(
- acEntry.getAutomationCompositionStatistics().getAcElementStatisticsList().getAcElementStatistics());
- }
- }
}
private void exceptionOccured(Response.Status status, String reason) throws AutomationCompositionException {