summaryrefslogtreecommitdiffstats
path: root/core/core-engine
diff options
context:
space:
mode:
authorRashmi Pujar <rashmi.pujar1@bell.ca>2022-01-26 22:39:11 -0500
committerRashmi Pujar <rashmi.pujar1@bell.ca>2022-02-09 14:26:16 -0500
commitd71f322fa9eb51967527b14c1eeeba49838464be (patch)
tree42ca8a44b0393711a395f2b3dc90f53a383a3be2 /core/core-engine
parenta84cda443bb55b74e89a61150814596d3a311dd3 (diff)
rename metrics as per global constants for prometheus
Issue-ID: POLICY-3760 Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca> Change-Id: I0fb59e8d9c95fd81a1754bb769705ef753b9022d
Diffstat (limited to 'core/core-engine')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java8
-rw-r--r--core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java3
2 files changed, 6 insertions, 5 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
index 7bd9087df..35139bfe4 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
@@ -56,6 +56,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType;
import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference;
import org.onap.policy.apex.model.policymodel.concepts.AxTask;
+import org.onap.policy.common.utils.resources.PrometheusUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -74,9 +75,10 @@ public class ApexEngineImpl implements ApexEngine {
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEngineImpl.class);
// Register state changes with prometheus
- static final Gauge ENGINE_STATE = Gauge.build().name("apex_engine_state").labelNames("engine_instance_id")
- .help("State of the APEX engine as integers mapped as - 0:UNDEFINED, 1:STOPPED, 2:READY,"
- + " 3:EXECUTING, 4:STOPPING").register();
+ static final Gauge ENGINE_STATE = Gauge.build().namespace(PrometheusUtils.PdpType.PDPA.getNamespace())
+ .name("engine_state").labelNames("engine_instance_id")
+ .help("State of the APEX engine as integers mapped as - 0:UNDEFINED, 1:STOPPED, 2:READY,"
+ + " 3:EXECUTING, 4:STOPPING").register();
// Recurring string constants
private static final String UPDATE_MODEL = "updateModel()<-";
diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java
index 88602206d..3b682acd6 100644
--- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java
+++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java
@@ -515,8 +515,7 @@ public class ApexEngineImplTest {
private void checkAxEngineStateMetric(AxEngineState state) {
Double stateMetric = CollectorRegistry.defaultRegistry
- .getSampleValue("apex_engine_state", new String[]{"engine_instance_id"},
- new String[]{ENGINE_ID});
+ .getSampleValue("pdpa_engine_state", new String[]{"engine_instance_id"}, new String[]{ENGINE_ID});
assertEquals(stateMetric.intValue(), state.getStateIdentifier());
}
} \ No newline at end of file