diff options
Diffstat (limited to 'feature-lifecycle/src/main')
-rw-r--r-- | feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java index 3cec7451..1326c3b0 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java @@ -53,7 +53,6 @@ import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; import org.onap.policy.common.endpoints.listeners.ScoListener; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.onap.policy.common.utils.coder.StandardCoderObject; -import org.onap.policy.drools.metrics.Metric; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.policies.DomainMaker; import org.onap.policy.drools.system.PolicyController; @@ -446,8 +445,8 @@ public class LifecycleFsm implements Startable { policiesMap.computeIfPresent(policy.getIdentifier(), (key, value) -> { // avoid counting reapplies in a second pass when a mix of native and non-native // policies are present. - getStats().setPolicyDeployCount(getStats().getPolicyDeployCount() + 1); - getStats().setPolicyDeploySuccessCount(getStats().getPolicyDeploySuccessCount() + 1); + getStats().setPolicyUndeployCount(getStats().getPolicyUndeployCount() + 1); + getStats().setPolicyUndeploySuccessCount(getStats().getPolicyUndeploySuccessCount() + 1); return null; }); } @@ -458,7 +457,8 @@ public class LifecycleFsm implements Startable { } protected void failedUndeployPolicyAction(ToscaPolicy failedPolicy) { - failedDeployPolicyAction(failedPolicy); + getStats().setPolicyUndeployCount(getStats().getPolicyUndeployCount() + 1); + getStats().setPolicyUndeployFailCount(getStats().getPolicyUndeployFailCount() + 1); policiesMap.remove(failedPolicy.getIdentifier()); } @@ -477,14 +477,24 @@ public class LifecycleFsm implements Startable { } } - protected void resetDeployCountsAction() { - getStats().setPolicyDeployCount(0); - getStats().setPolicyDeployFailCount(0); - getStats().setPolicyDeploySuccessCount(0); + protected void updateUndeployCountsAction(Long undeployCount, Long undeploySuccesses, Long undeployFailures) { + PdpStatistics statistics = getStats(); + if (undeployCount != null) { + statistics.setPolicyUndeployCount(undeployCount); + } + + if (undeploySuccesses != null) { + statistics.setPolicyUndeploySuccessCount(undeploySuccesses); + } + + if (undeployFailures != null) { + statistics.setPolicyUndeployFailCount(undeployFailures); + } } protected List<ToscaPolicy> resetPoliciesAction() { - resetDeployCountsAction(); + updateDeployCountsAction(0L, 0L, 0L); + updateUndeployCountsAction(0L, 0L, 0L); List<ToscaPolicy> policies = new ArrayList<>(getActivePolicies()); policiesMap.clear(); return policies; |