aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorisaac <isaac.adorno@att.com>2022-02-28 14:49:07 -0600
committerisaac <isaac.adorno@att.com>2022-03-02 09:20:54 -0600
commit4873a65384639607dbab45846a7ff53775ee0a79 (patch)
treeb9fa458567ce2075f4e2355815458029e360379c /main/src
parent445d27d85dda4e23c593fc9c604bfe9cb68f8516 (diff)
Adding Prometheus counts to XacmlPdpStatisticsManager
Issue-ID: POLICY-3762 Signed-off-by: isaac <isaac.adorno@att.com> Change-Id: I865fc01dac91fe77421fc2fceb72eac49c9d8a78
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpStatisticsManager.java19
1 files changed, 19 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 c040ae6a..609da8f6 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
@@ -20,9 +20,12 @@
package org.onap.policy.pdpx.main.rest;
+import io.prometheus.client.Counter;
import lombok.Getter;
import lombok.Setter;
import lombok.Synchronized;
+import org.onap.policy.common.utils.resources.PrometheusUtils;
+import org.onap.policy.models.pdp.enums.PdpResponseStatus;
/**
* Class to hold statistical data for xacmlPdp component.
@@ -32,6 +35,14 @@ public class XacmlPdpStatisticsManager {
@Getter
@Setter
private static XacmlPdpStatisticsManager current = null;
+ protected static final String PROMETHEUS_NAMESPACE = "pdpx";
+
+ protected static final Counter deploymentsCounter =
+ Counter.build().namespace(PROMETHEUS_NAMESPACE).name(PrometheusUtils.POLICY_DEPLOYMENTS_METRIC)
+ .labelNames(PrometheusUtils.OPERATION_METRIC_LABEL,
+ PrometheusUtils.STATUS_METRIC_LABEL)
+ .help(PrometheusUtils.POLICY_DEPLOYMENT_HELP)
+ .register();
private long totalPolicyTypesCount;
private long totalPoliciesCount;
@@ -108,6 +119,8 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateDeploySuccessCount() {
+ deploymentsCounter.labels(PrometheusUtils.DEPLOY_OPERATION,
+ PdpResponseStatus.SUCCESS.name()).inc();
return ++deploySuccessCount;
}
@@ -118,6 +131,8 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateDeployFailureCount() {
+ deploymentsCounter.labels(PrometheusUtils.DEPLOY_OPERATION,
+ PdpResponseStatus.FAIL.name()).inc();
return ++deployFailureCount;
}
@@ -128,6 +143,8 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateUndeploySuccessCount() {
+ deploymentsCounter.labels(PrometheusUtils.UNDEPLOY_OPERATION,
+ PdpResponseStatus.SUCCESS.name()).inc();
return ++undeploySuccessCount;
}
@@ -138,6 +155,8 @@ public class XacmlPdpStatisticsManager {
*/
@Synchronized
public long updateUndeployFailureCount() {
+ deploymentsCounter.labels(PrometheusUtils.UNDEPLOY_OPERATION,
+ PdpResponseStatus.FAIL.name()).inc();
return ++undeployFailureCount;
}