xacml-dpd statistics
Has this XacmlPdpStatisticsManager class with the counter/update actions
private static XacmlPdpStatisticsManager current object is never used, only setted.
Code Block | ||
---|---|---|
| ||
public class XacmlPdpStatisticsManager {
@Getter
@Setter
private static XacmlPdpStatisticsManager current = null;
private long totalPolicyTypesCount;
private long totalPoliciesCount;
private long errorsCount;
private long permitDecisionsCount;
private long denyDecisionsCount;
private long indeterminantDecisionsCount;
private long notApplicableDecisionsCount;
} |
drools-pdp
Uses the PolicyStats class to have the numbers but for policy execution
Code Block | ||
---|---|---|
| ||
public class PolicyStats {
private static final Logger logger = getLogger(PolicyStats.class);
/**
* Number of executed policy transactions.
*/
private long policyExecutedCount;
/**
* Number of successfully executed policy transactions.
*/
private long policyExecutedSuccessCount;
/**
* Number of failed executions of policy transactions.
*/
private long policyExecutedFailCount;
/**
* Last time the policy transaction was executed.
*/
private long lastExecutionTime;
/**
* Average execution time of a policy transaction.
*/
private double averageExecutionTime;
/**
* Total policy execution times.
*/
private double totalElapsedTime;
/**
* Uptime of the entity holding the stats.
*/
private long birthTime = Instant.now().toEpochMilli();
/**
* Time last transaction was started.
*/
private long lastStart;
} |
pap
Code Block | ||
---|---|---|
| ||
public class PapStatisticsManager {
private final AtomicLong totalPdpCount = new AtomicLong(0);
private final AtomicLong totalPdpGroupCount = new AtomicLong(0);
private final AtomicLong totalPolicyDeployCount = new AtomicLong(0);
private final AtomicLong policyDeploySuccessCount = new AtomicLong(0);
private final AtomicLong policyDeployFailureCount = new AtomicLong(0);
private final AtomicLong totalPolicyDownloadCount = new AtomicLong(0);
private final AtomicLong policyDownloadSuccessCount = new AtomicLong(0);
private final AtomicLong policyDownloadFailureCount = new AtomicLong(0);
} |
apex-pdp
Code Block | ||
---|---|---|
| ||
public class ApexPolicyStatisticsManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ApexPolicyStatisticsManager.class);
public static final String REG_APEX_PDP_POLICY_COUNTER = "object:pdp/statistics/policy/counter";
private final AtomicLong policyDeployCount = new AtomicLong(0);
private final AtomicLong policyDeploySuccessCount = new AtomicLong(0);
private final AtomicLong policyDeployFailCount = new AtomicLong(0);
private final AtomicLong policyExecutedCount = new AtomicLong(0);
private final AtomicLong policyExecutedSuccessCount = new AtomicLong(0);
private final AtomicLong policyExecutedFailCount = new AtomicLong(0);
} |
deploy count is updated on message handler method startApexEngine, startApexEngineBasedOnPolicies
policies to undeploy are mentioned on startApexEngineBasedOnPolicies and stopApexEngineBasedOnPolicies
should we update the count on the mentioned methods for when there's a list of policies to undeploy?
Code Block | ||
---|---|---|
| ||
private PdpResponseDetails startApexEngineBasedOnPolicies(final PdpUpdate pdpUpdateMsg,
final PdpMessageHandler pdpMessageHandler, ApexEngineHandler apexEngineHandler) |
Questions:
- all the mentioned classes track different operations?
- can we have one class with common counters then add the extra?
- are they all converging to Pdp Statistics entity?
Proposed solution
- create a class with deploy/undeploy fields
- an object of this class will be added to the ones counting deployments actions
- that way, classes not using those counters won't be affected.
more to comeChanges were related to the statistics saved on DB
models:
Addded the undeploy counts on Pdp Statistics concept/entity.
pap:
Updated the Pdp message to process undeploy counts.
drools-pdp:
Updated the Lifecycle for Pdp updates
apex-pdp:
Updated the start/stop basedOnPolicies methods to check for deploy/undeploy lists and increase the ref count.
All the services listening to PdpUpdate messages check for deploy and undeploy separately and increase the counts.
The in memory manager for statistics are not affected, except for apex-pdp - it checks from the in memory manager to send through pdp message.
Code reviews:
https://gerrit.onap.org/r/c/policy/models/+/122453 (merged)
https://gerrit.onap.org/r/c/policy/pap/+/122499 (merged)