From e02ad3ed9ce507d8b78cc511ea1832a86f77c274 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 6 Apr 2022 15:42:02 +0100 Subject: Add application metrics in the onboarding backend A new endpoint was introduced /onboarding-api/v1.0/actuator/prometheus in the onboarding backend, that returns application metrics in a format consumable by prometheus, using the micrometer library. Change-Id: I684b5cab55947c6bedee1b838343676489ad3ebf Issue-ID: SDC-3956 Signed-off-by: andre.schmid --- .../sdcrests/config/MicrometerSpringConfig.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/metrics-rest/src/main/java/org/openecomp/sdcrests/config/MicrometerSpringConfig.java (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/metrics-rest/src/main/java/org/openecomp/sdcrests/config') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/metrics-rest/src/main/java/org/openecomp/sdcrests/config/MicrometerSpringConfig.java b/openecomp-be/api/openecomp-sdc-rest-webapp/metrics-rest/src/main/java/org/openecomp/sdcrests/config/MicrometerSpringConfig.java new file mode 100644 index 0000000000..847f6bcf0d --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/metrics-rest/src/main/java/org/openecomp/sdcrests/config/MicrometerSpringConfig.java @@ -0,0 +1,38 @@ +/* + * - + * ============LICENSE_START======================================================= + * Copyright (C) 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. + * 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.openecomp.sdcrests.config; + +import io.micrometer.prometheus.PrometheusConfig; +import io.micrometer.prometheus.PrometheusMeterRegistry; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class MicrometerSpringConfig { + + @Bean(name = "prometheusRegistry") + PrometheusMeterRegistry prometheusRegistry() { + return new PrometheusMeterRegistry(PrometheusConfig.DEFAULT); + } + +} + -- cgit 1.2.3-korg