From 82053168f8029d03635a3953fd3635f5781f7ef9 Mon Sep 17 00:00:00 2001 From: jmarchel7bulls Date: Tue, 14 May 2024 10:16:29 +0200 Subject: [PATCH] Add filtering of messages Change-Id: I56fc172a1424bd3f5e0a217aef2fe8914950fbc5 --- .idea/compiler.xml | 2 ++ .idea/modules.xml | 1 - .idea/prediction-orchestrator.iml | 12 ++++-------- prediction-orchestrator/pom.xml | 10 ++++++++++ .../ApplicationSpecificPredictionConsumer.java | 13 +++++++++++++ 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 248f0f5..f843e9c 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -15,6 +15,7 @@ + @@ -27,6 +28,7 @@ \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 38dde96..70f3ca2 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,6 @@ - diff --git a/.idea/prediction-orchestrator.iml b/.idea/prediction-orchestrator.iml index efb4d78..d6ebd48 100644 --- a/.idea/prediction-orchestrator.iml +++ b/.idea/prediction-orchestrator.iml @@ -1,13 +1,9 @@ - + + - - - + + \ No newline at end of file diff --git a/prediction-orchestrator/pom.xml b/prediction-orchestrator/pom.xml index b25471b..19333ac 100644 --- a/prediction-orchestrator/pom.xml +++ b/prediction-orchestrator/pom.xml @@ -21,6 +21,11 @@ spring-boot-starter + + com.fasterxml.jackson.core + jackson-core + 2.13.0 + org.projectlombok lombok @@ -31,6 +36,11 @@ spring-boot-starter-test test + + com.fasterxml.jackson.core + jackson-databind + 2.15.2 + eu.nebulouscloud diff --git a/prediction-orchestrator/src/main/java/eu/nebulouscloud/predictionorchestrator/ApplicationSpecificPredictionConsumer.java b/prediction-orchestrator/src/main/java/eu/nebulouscloud/predictionorchestrator/ApplicationSpecificPredictionConsumer.java index 76426f5..24ee749 100644 --- a/prediction-orchestrator/src/main/java/eu/nebulouscloud/predictionorchestrator/ApplicationSpecificPredictionConsumer.java +++ b/prediction-orchestrator/src/main/java/eu/nebulouscloud/predictionorchestrator/ApplicationSpecificPredictionConsumer.java @@ -48,9 +48,22 @@ public class ApplicationSpecificPredictionConsumer extends Consumer { String metricName = parts[parts.length - 1]; log.debug("Extracted metric name: {}", metricName); // Log the extracted metric name + // Remove "app_wide_scope_" prefix if present + if (metricName.startsWith("app_wide_scope_")) { + metricName = metricName.substring(16); + log.debug("Removed 'app_wide_scope_' prefix. New metric name: {}", metricName); + } + String publisherKey = "predicted_metrics_" + metricName; PredictedMetricsPublisher predictedMetricsPublisher = (PredictedMetricsPublisher) ctx.getPublisher(publisherKey); + // Remove "app_wide_scope_" prefix if present + if (metricName.startsWith("app_wide_scope_")) { + metricName = metricName.substring(16); + log.debug("Removed 'app_wide_scope_' prefix. New metric name: {}", metricName); + } + + if (predictedMetricsPublisher == null) { log.info("PredictedMetricsPublisher for metric {} not found, creating a new one.", metricName); predictedMetricsPublisher = new PredictedMetricsPublisher(metricName);