diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2022-08-31 14:12:15 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2022-09-01 14:57:30 +0000 |
commit | 37a6e5e0f321ad659e5009092490a40892b6551a (patch) | |
tree | edd9f7a15055d09ae2ce725900774b47ebc04292 /participant/participant-impl/participant-impl-acelement/src/main | |
parent | a6896ee8eaa79588ac45638ed236ba4d37ec1c42 (diff) |
Refactor Element ACM for prometheus configuration
Issue-ID: POLICY-4337
Change-Id: Ic8e43748bc8ffc9a9513f7f278afae9f3f393bc9
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-acelement/src/main')
3 files changed, 19 insertions, 9 deletions
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/MicrometerConfig.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/MicrometerConfig.java index 8e83a7739..d34b34add 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/MicrometerConfig.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/MicrometerConfig.java @@ -22,12 +22,23 @@ package org.onap.policy.clamp.acm.element.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; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class MicrometerConfig { + /** + * Load up the metrics registry. + */ + @Bean + public InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor, + MeterRegistry registry) { + return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, ""); + } + @Bean public TimedAspect timedAspect(MeterRegistry registry) { return new TimedAspect(registry); diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AbstractRestController.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AbstractRestController.java index 408458f99..7c963b6da 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AbstractRestController.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AbstractRestController.java @@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping; */ // @formatter:off @RequestMapping( - value = "/v2", + value = "/onap/policy/clamp/acelement/v2", produces = { MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML diff --git a/participant/participant-impl/participant-impl-acelement/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-acelement/src/main/resources/config/application.yaml index 4a0f0d301..4d7710304 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-acelement/src/main/resources/config/application.yaml @@ -1,22 +1,21 @@ spring: security: user: - name: acmUser - password: zb!XztG34 + name: ${REST_USER:acmUser} + password: ${REST_PASSWORD:zb!XztG34} server: - port: 8084 - servlet: - context-path: /onap/policy/clamp/acelement/ + port: ${PORT:8084} error: path: /error element: elementId: - name: onap.policy.clamp.ac.element1 - version: 1.0.0 + name: ${ELEMENT_ID:onap.policy.clamp.ac.element1} + version: ${ELEMENT_VERSION:1.0.0} management: endpoints: web: + base-path: / exposure: - include: health, metrics, prometheus
\ No newline at end of file + include: health, metrics, prometheus |