summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2023-08-07 15:40:30 -0400
committerRam Krishna Verma <ram_krishna.verma@bell.ca>2023-08-07 15:40:35 -0400
commit88b6b1fe6db0c107362670520b8437b1e163eec4 (patch)
tree131b41a76719d29db86d20f2b0e44f7d85059744
parent430e73f45e65f78f7d85a9c43cfe178886b5bfa6 (diff)
Remove db based statistics from xacml-pdp
Removing the db based statistics from xacml-pdp, in favour of the prometheus based option. Issue-ID: POLICY-4109 Change-Id: Ibd2dfe27aa53fc486585d182985cf743801a1de7 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java36
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java21
2 files changed, 0 insertions, 57 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java b/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
index 3635a21a..7f40532d 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
@@ -20,21 +20,18 @@
package org.onap.policy.pdpx.main;
-import java.time.Instant;
import java.util.Collections;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.models.pdp.concepts.PdpMessage;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
-import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
-import org.onap.policy.pdpx.main.rest.XacmlPdpStatisticsManager;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,43 +93,10 @@ public class XacmlState {
: PdpHealthStatus.NOT_HEALTHY);
PdpStatus heartbeat = new PdpStatus(status);
- heartbeat.setStatistics(getStatistics());
return heartbeat;
}
/**
- * Generates statistics to be used in a heart beat message.
- *
- * @return statistics for heart beat message
- */
- protected PdpStatistics getStatistics() {
- XacmlPdpStatisticsManager stats = XacmlPdpStatisticsManager.getCurrent();
- if (stats == null) {
- LOGGER.warn("XacmlPdpStatisticsManager is null");
- return null;
- }
- stats.setTotalPolicyCount(appManager.getPolicyCount());
-
- PdpStatistics pdpStats = new PdpStatistics();
- pdpStats.setPdpGroupName(this.status.getPdpGroup());
- pdpStats.setPdpSubGroupName(this.status.getPdpSubgroup());
- pdpStats.setTimeStamp(Instant.ofEpochSecond(this.status.getTimestampMs()));
-
- pdpStats.setPolicyExecutedCount(stats.getPermitDecisionsCount() + stats.getDenyDecisionsCount());
- pdpStats.setPolicyExecutedSuccessCount(stats.getPermitDecisionsCount());
- pdpStats.setPolicyExecutedFailCount(stats.getDenyDecisionsCount());
-
- pdpStats.setPolicyDeployCount(stats.getDeploySuccessCount() + stats.getDeployFailureCount());
- pdpStats.setPolicyDeploySuccessCount(stats.getDeploySuccessCount());
- pdpStats.setPolicyDeployFailCount(stats.getDeployFailureCount());
-
- pdpStats.setPolicyUndeployCount(stats.getUndeploySuccessCount() + stats.getUndeployFailureCount());
- pdpStats.setPolicyUndeploySuccessCount(stats.getUndeploySuccessCount());
- pdpStats.setPolicyUndeployFailCount(stats.getUndeployFailureCount());
- return pdpStats;
- }
-
- /**
* Updates the internal state based on the given message.
*
* @param message message from which to update the internal state
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
index a1f1b8a7..a16f3a8f 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java
@@ -42,7 +42,6 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
-import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
@@ -132,26 +131,6 @@ public class XacmlStateTest {
TopicSinkClient client = Mockito.mock(TopicSinkClient.class);
XacmlPdpUpdatePublisher publisher = new XacmlPdpUpdatePublisher(client, state, appmgr);
publisher.handlePdpUpdate(message);
-
- PdpStatistics stats = state.getStatistics();
- assertNotNull(stats);
- assertEquals(GROUP, stats.getPdpGroupName());
- assertEquals(1, stats.getPolicyDeployCount());
- assertEquals(1, stats.getPolicyDeploySuccessCount());
- assertEquals(0, stats.getPolicyDeployFailCount());
- assertEquals(1, stats.getPolicyUndeployCount());
- assertEquals(1, stats.getPolicyUndeployFailCount());
- assertEquals(0, stats.getPolicyUndeploySuccessCount());
-
- PdpStatistics test = new PdpStatistics();
- test.setTimeStamp(stats.getTimeStamp());
- test.setPdpGroupName(GROUP);
- test.setPolicyDeployCount(1);
- test.setPolicyDeploySuccessCount(1);
- test.setPolicyUndeployCount(1);
- test.setPolicyUndeployFailCount(1);
-
- assertEquals(stats.toString(), test.toString());
}
@Test