================================================================================
Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved.
Modifications Copyright (C) 2020 Bell Canada.
- Modifications Copyright (C) 2023-2024 Nordix Foundation.
+ Modifications Copyright (C) 2023-2025 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-->
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
- <artifactId>simpleclient</artifactId>
+ <artifactId>prometheus-metrics-core</artifactId>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
- <artifactId>simpleclient_logback</artifactId>
- </dependency>
- <dependency>
- <groupId>io.prometheus</groupId>
- <artifactId>simpleclient_hotspot</artifactId>
+ <artifactId>prometheus-metrics-instrumentation-jvm</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
- <artifactId>simpleclient_servlet_jakarta</artifactId>
+ <artifactId>prometheus-metrics-exporter-servlet-jakarta</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019, 2021-2022 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.pdpx.main.rest;
-import io.prometheus.client.Counter;
+import io.prometheus.metrics.core.metrics.Counter;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
public static final String APPLICATION = "application";
protected static final Counter deploymentsCounter =
- Counter.build().namespace(PROMETHEUS_NAMESPACE).name(PrometheusUtils.POLICY_DEPLOYMENTS_METRIC)
+ Counter.builder()
+ .name(PROMETHEUS_NAMESPACE + "_" + PrometheusUtils.POLICY_DEPLOYMENTS_METRIC)
.labelNames(PrometheusUtils.OPERATION_METRIC_LABEL,
PrometheusUtils.STATUS_METRIC_LABEL)
.help(PrometheusUtils.POLICY_DEPLOYMENT_HELP)
.register();
protected static final Counter decisionsCounter =
- Counter.build().namespace(PROMETHEUS_NAMESPACE).name(POLICY_DECISIONS_METRIC)
+ Counter.builder()
+ .name(PROMETHEUS_NAMESPACE + "_" + POLICY_DECISIONS_METRIC)
.labelNames(APPLICATION, PrometheusUtils.STATUS_METRIC_LABEL)
.help(POLICY_DECISIONS_HELP)
.register();
*/
@Synchronized
public void updatePermitDecisionsCount(String appName) {
- decisionsCounter.labels(appName, PERMIT_OPERATION).inc();
+ decisionsCounter.labelValues(appName, PERMIT_OPERATION).inc();
updateApplicationMetrics(appName, "permit_decisions_count");
++permitDecisionsCount;
}
*/
@Synchronized
public void updateDenyDecisionsCount(String appName) {
- decisionsCounter.labels(appName, DENY_OPERATION).inc();
+ decisionsCounter.labelValues(appName, DENY_OPERATION).inc();
updateApplicationMetrics(appName, "deny_decisions_count");
++denyDecisionsCount;
}
*/
@Synchronized
public void updateIndeterminantDecisionsCount(String appName) {
- decisionsCounter.labels(appName, INDETERMINANT_OPERATION).inc();
+ decisionsCounter.labelValues(appName, INDETERMINANT_OPERATION).inc();
updateApplicationMetrics(appName, "indeterminant_decisions_count");
++indeterminantDecisionsCount;
}
*/
@Synchronized
public void updateNotApplicableDecisionsCount(String appName) {
- decisionsCounter.labels(appName, NOT_APPLICABLE_OPERATION).inc();
+ decisionsCounter.labelValues(appName, NOT_APPLICABLE_OPERATION).inc();
updateApplicationMetrics(appName, "not_applicable_decisions_count");
++notApplicableDecisionsCount;
}
*/
@Synchronized
public void updateDeploySuccessCount() {
- deploymentsCounter.labels(PrometheusUtils.DEPLOY_OPERATION,
+ deploymentsCounter.labelValues(PrometheusUtils.DEPLOY_OPERATION,
PdpResponseStatus.SUCCESS.name()).inc();
++deploySuccessCount;
}
*/
@Synchronized
public void updateDeployFailureCount() {
- deploymentsCounter.labels(PrometheusUtils.DEPLOY_OPERATION,
+ deploymentsCounter.labelValues(PrometheusUtils.DEPLOY_OPERATION,
PdpResponseStatus.FAIL.name()).inc();
++deployFailureCount;
}
*/
@Synchronized
public void updateUndeploySuccessCount() {
- deploymentsCounter.labels(PrometheusUtils.UNDEPLOY_OPERATION,
+ deploymentsCounter.labelValues(PrometheusUtils.UNDEPLOY_OPERATION,
PdpResponseStatus.SUCCESS.name()).inc();
++undeploySuccessCount;
}
*/
@Synchronized
public void updateUndeployFailureCount() {
- deploymentsCounter.labels(PrometheusUtils.UNDEPLOY_OPERATION,
+ deploymentsCounter.labelValues(PrometheusUtils.UNDEPLOY_OPERATION,
PdpResponseStatus.FAIL.name()).inc();
++undeployFailureCount;
}