From ecc85ec4c6af67dc1ba2ff20b7473925e6657b11 Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Mon, 9 Aug 2021 12:01:02 +0100 Subject: Integrating prometheus with Policy components With this change, all PF components can export prometheus metrics by default. The prometheus metrics servlet will be running on /metrics servletPath.. If the metrics shouldn't be exported, just add a flag "promethus": false in the restServerParameters of default configuration file. This brings up prometheus servlet on /metrics servletPath. Also as part of standard servlet support, "servletUriPath" and "servletClass" are 2 other fields added to RestServerParameters which can be used to add standard servlets. This can be revisited later if needed. Basically, any servlet can be added by passing these fields, for example, to add prometheus metrics servlet on /test/metrics, add the below to restServerParameters: "servletUriPath": "/test/metrics", "servletClass": "io.prometheus.client.exporter.MetricsServlet" In addition, we can later go to individual components and add more metrics, say for e.g., deployedPoliciesCounter/undeployedPoliciesCounter etc on PAP, executedEvents/failedEvents etc on PDP and so on. This will look something like below, for e.g. in policy-pap component: io.prometheus.client.Counter counter = Counter.build() .name("policies_deployed_total") .help("Number of policies deployed.").register() Whenever a policy is deployed, just call counter.inc() Usage of code like above in the individual component will expose such data as well as part of the exposed metrics. Change-Id: Id667f27b15c012398421ba657b5324cc1d82cf1f Issue-ID: POLICY-3524 Signed-off-by: a.sreekumar Signed-off-by: jhh Signed-off-by: a.sreekumar --- policy-endpoints/pom.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'policy-endpoints/pom.xml') diff --git a/policy-endpoints/pom.xml b/policy-endpoints/pom.xml index 4bf44520..3c1a6f8d 100644 --- a/policy-endpoints/pom.xml +++ b/policy-endpoints/pom.xml @@ -3,6 +3,7 @@ Copyright (C) 2018 Ericsson. All rights reserved. Modifications Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2019-2020 Nordix Foundation. + Modifications Copyright (C) 2021 Bell Canada. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -40,6 +41,7 @@ 1.2.1-oss 4.5.5 4.4.4 + 0.11.0 @@ -84,6 +86,12 @@ jackson-module-jaxb-annotations + + com.fasterxml.jackson.core + jackson-annotations + ${version.jackson} + + org.onap.dmaap.messagerouter.dmaapclient dmaapClient @@ -163,6 +171,18 @@ swagger-jersey2-jaxrs + + io.prometheus + simpleclient_hotspot + ${io.prometheus.version} + + + + io.prometheus + simpleclient_servlet + ${io.prometheus.version} + + org.apache.commons commons-collections4 -- cgit 1.2.3-korg