user:
name: ${REST_USER:acmUser}
password: ${REST_PASSWORD:zb!XztG34}
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
server:
port: ${PORT:8084}
user:
name: participantUser
password: zb!XztG34
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
+
security:
enable-csrf: false
participant:
management:
endpoints:
web:
+ base-path: /
exposure:
include: health, metrics, prometheus
server:
user:
name: participantUser
password: zb!XztG34
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
+
security:
enable-csrf: false
management:
endpoints:
web:
+ base-path: /
exposure:
include: health, metrics, prometheus
server:
protocols:
- http
- - https
\ No newline at end of file
+ - https
user:
name: participantUser
password: zb!XztG34
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
participant:
pdpGroup: defaultGroup
management:
endpoints:
web:
+ base-path: /
exposure:
include: health, metrics, prometheus
server:
--- /dev/null
+/*-
+ * ============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.onap.policy.clamp.acm.participant.http.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);
+ }
+}
user:
name: participantUser
password: zb!XztG34
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
+
security:
enable-csrf: false
participant:
topicSources:
- topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- - ${topicServer:message-router}
+ - ${topicServer:localhost}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
- topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- - ${topicServer:message-router}
+ - ${topicServer:localhost}
topicCommInfrastructure: dmaap
management:
endpoints:
web:
+ base-path: /
exposure:
include: health, metrics, prometheus
server:
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/policy/clamp/acm/httpparticipant";
- public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/httpparticipant/";
private static String httpPrefix;
* @return a request builder
*/
protected Invocation.Builder sendActRequest(final String endpoint) {
- return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, true);
+ return sendFqeRequest(httpPrefix + CONTEXT_PATH + endpoint, true);
}
/**
* @return a request builder
*/
protected Invocation.Builder sendNoAuthActRequest(final String endpoint) {
- return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, false);
+ return sendFqeRequest(httpPrefix + CONTEXT_PATH + endpoint, false);
}
/**
--- /dev/null
+/*-
+ * ============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.onap.policy.clamp.acm.participant.kubernetes.configurations;
+
+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);
+ }
+}
user:
name: participantUser
password: zb!XztG34
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
+
security:
enable-csrf: false
management:
endpoints:
web:
+ base-path: /
exposure:
include: health, metrics, prometheus
server:
protocols:
- http
- - https
\ No newline at end of file
+ - https
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
+import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.context.annotation.Import;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@WebMvcTest(value = ChartController.class, properties = "chart.api.enabled=true")
+@Import({MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class})
@EnableConfigurationProperties(value = ParticipantK8sParameters.class)
class ChartControllerTest {
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/policy/clamp/acm/k8sparticipant";
- public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/k8sparticipant/";
private static String httpPrefix;
* @return a request builder
*/
protected Invocation.Builder sendActRequest(final String endpoint) {
- return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, true);
+ return sendFqeRequest(httpPrefix + CONTEXT_PATH + endpoint, true);
}
/**
* @return a request builder
*/
protected Invocation.Builder sendNoAuthActRequest(final String endpoint) {
- return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, false);
+ return sendFqeRequest(httpPrefix + CONTEXT_PATH + endpoint, false);
}
/**
--- /dev/null
+/*-
+ * ============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.onap.policy.clamp.acm.participant.policy.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);
+ }
+}
user:
name: participantUser
password: zb!XztG34
+ autoconfigure:
+ exclude:
+ - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
+ - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+ - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
participant:
pdpGroup: defaultGroup
management:
endpoints:
web:
+ base-path: /
exposure:
include: health, metrics, prometheus
server:
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/policy/clamp/acm/policyparticipant";
- public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/policyparticipant/";
private static String httpPrefix;
* @return a request builder
*/
protected Invocation.Builder sendActRequest(final String endpoint) {
- return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, true);
+ return sendFqeRequest(httpPrefix + CONTEXT_PATH + endpoint, true);
}
/**
* @return a request builder
*/
protected Invocation.Builder sendNoAuthActRequest(final String endpoint) {
- return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, false);
+ return sendFqeRequest(httpPrefix + CONTEXT_PATH + endpoint, false);
}
/**
/*-
* ============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.participant.intermediary.comm;
+import io.micrometer.core.annotation.Timed;
import java.util.List;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
*
* @param participantStatus the Participant Status
*/
+ @Timed(value = "publisher.participant_status", description = "PARTICIPANT_STATUS messages published")
public void sendParticipantStatus(final ParticipantStatus participantStatus) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantStatus);
LOGGER.debug("Sent Participant Status message to CLAMP - {}", participantStatus);
}
*
* @param participantRegister the Participant Status
*/
+ @Timed(value = "publisher.participant_register", description = "PARTICIPANT_REGISTER messages published")
public void sendParticipantRegister(final ParticipantRegister participantRegister) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantRegister);
LOGGER.debug("Sent Participant Register message to CLAMP - {}", participantRegister);
}
*
* @param participantDeregister the Participant Status
*/
+ @Timed(value = "publisher.participant_deregister", description = "PARTICIPANT_DEREGISTER messages published")
public void sendParticipantDeregister(final ParticipantDeregister participantDeregister) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantDeregister);
LOGGER.debug("Sent Participant Deregister message to CLAMP - {}", participantDeregister);
}
*
* @param participantUpdateAck the Participant Update Ack
*/
+ @Timed(value = "publisher.participant_update_ack", description = "PARTICIPANT_UPDATE_ACK messages published")
public void sendParticipantUpdateAck(final ParticipantUpdateAck participantUpdateAck) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantUpdateAck);
LOGGER.debug("Sent Participant Update Ack message to CLAMP - {}", participantUpdateAck);
}
*
* @param automationCompositionAck AutomationComposition Update/StateChange Ack
*/
+ @Timed(value = "publisher.automation_composition_update_ack",
+ description = "AUTOMATION_COMPOSITION_UPDATE_ACK/AUTOMATION_COMPOSITION_STATECHANGE_ACK messages published")
public void sendAutomationCompositionAck(final AutomationCompositionAck automationCompositionAck) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(automationCompositionAck);
LOGGER.debug("Sent AutomationComposition Update/StateChange Ack to runtime - {}", automationCompositionAck);
}
*
* @param participantStatus the Participant Status
*/
+ @Timed(value = "publisher.participant_status", description = "PARTICIPANT_STATUS messages published")
public void sendHeartbeat(final ParticipantStatus participantStatus) {
+ validate();
+ topicSinkClient.send(participantStatus);
+ LOGGER.debug("Sent Participant heartbeat to CLAMP - {}", participantStatus);
+ }
+
+ private void validate() {
if (!active) {
throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
- topicSinkClient.send(participantStatus);
- LOGGER.debug("Sent Participant heartbeat to CLAMP - {}", participantStatus);
}
@Override
package org.onap.policy.clamp.acm.participant.intermediary.handler;
+import io.micrometer.core.annotation.Timed;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
*
* @param participantStatusReqMsg participant participantStatusReq message
*/
+ @Timed(value = "listener.participant_status_req",
+ description = "PARTICIPANT_STATUS_REQ messages received")
public void handleParticipantStatusReq(final ParticipantStatusReq participantStatusReqMsg) {
var participantStatus = makeHeartbeat(true);
publisher.sendParticipantStatus(participantStatus);
*
* @param updateMsg the update message
*/
+ @Timed(value = "listener.automation_composition_update",
+ description = "AUTOMATION_COMPOSITION_UPDATE messages received")
public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg, acElementDefsOnThisParticipant);
}
*
* @param stateChangeMsg the state change message
*/
+ @Timed(value = "listener.automation_composition_state_change",
+ description = "AUTOMATION_COMPOSITION_STATE_CHANGE messages received")
public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg) {
automationCompositionHandler.handleAutomationCompositionStateChange(stateChangeMsg,
acElementDefsOnThisParticipant);
*
* @param participantRegisterAckMsg the participantRegisterAck message
*/
+ @Timed(value = "listener.participant_register_ack",
+ description = "PARTICIPANT_REGISTER_ACK messages received")
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
participantRegisterAckMsg.getResponseTo());
*
* @param participantDeregisterAckMsg the participantDeregisterAck message
*/
+ @Timed(value = "listener.participant_deregister_ack",
+ description = "PARTICIPANT_DEREGISTER_ACK messages received")
public void handleParticipantDeregisterAck(ParticipantDeregisterAck participantDeregisterAckMsg) {
LOGGER.debug("ParticipantDeregisterAck message received as responseTo {}",
participantDeregisterAckMsg.getResponseTo());
*
* @param participantUpdateMsg the ParticipantUpdate message
*/
+ @Timed(value = "listener.participant_update",
+ description = "PARTICIPANT_UPDATE messages received")
public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
LOGGER.debug("ParticipantUpdate message received for participantId {}",
participantUpdateMsg.getParticipantId());