aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2022-03-11 21:30:59 +0000
committerGerrit Code Review <gerrit@onap.org>2022-03-11 21:30:59 +0000
commit5208093292af76bc920eb8e6e7faba7110ce9c7a (patch)
treea3e21262c5849e039d6ece8fbd16f1762e34a857
parent988c024abf5a63067f1d508b227cb144af79848e (diff)
parent895ccff0e9ecf6cffbf517fbbdb05ea009f31f1c (diff)
Merge "Extending Prometheus counts to include permit / deny / indeterminant"
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpStatisticsManager.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpStatisticsManager.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpStatisticsManager.java
index 609da8f6..26ccfd35 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpStatisticsManager.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpStatisticsManager.java
@@ -36,6 +36,12 @@ public class XacmlPdpStatisticsManager {
@Setter
private static XacmlPdpStatisticsManager current = null;
protected static final String PROMETHEUS_NAMESPACE = "pdpx";
+ protected static final String POLICY_DECISIONS_METRIC = "policy_decisions";
+ public static final String POLICY_DECISIONS_HELP = "The total number of policy decisions.";
+ public static final String PERMIT_OPERATION = "permit";
+ public static final String DENY_OPERATION = "deny";
+ public static final String INDETERMINANT_OPERATION = "indeterminant";
+ public static final String NOT_APPLICABLE_OPERATION = "not_applicable";
protected static final Counter deploymentsCounter =
Counter.build().namespace(PROMETHEUS_NAMESPACE).name(PrometheusUtils.POLICY_DEPLOYMENTS_METRIC)
@@ -44,6 +50,12 @@ public class XacmlPdpStatisticsManager {
.help(PrometheusUtils.POLICY_DEPLOYMENT_HELP)
.register();
+ protected static final Counter decisionsCounter =
+ Counter.build().namespace(PROMETHEUS_NAMESPACE).name(POLICY_DECISIONS_METRIC)
+ .labelNames(PrometheusUtils.STATUS_METRIC_LABEL)
+ .help(POLICY_DECISIONS_HELP)
+ .register();
+
private long totalPolicyTypesCount;
private long totalPoliciesCount;
private long errorCount;
@@ -99,6 +111,7 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updatePermitDecisionsCount() {
+ decisionsCounter.labels(PERMIT_OPERATION).inc();
return ++permitDecisionsCount;
}
@@ -109,6 +122,7 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateDenyDecisionsCount() {
+ decisionsCounter.labels(DENY_OPERATION).inc();
return ++denyDecisionsCount;
}
@@ -167,6 +181,7 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateIndeterminantDecisionsCount() {
+ decisionsCounter.labels(INDETERMINANT_OPERATION).inc();
return ++indeterminantDecisionsCount;
}
@@ -177,6 +192,7 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateNotApplicableDecisionsCount() {
+ decisionsCounter.labels(NOT_APPLICABLE_OPERATION).inc();
return ++notApplicableDecisionsCount;
}