Add filtering of messages

Change-Id: I56fc172a1424bd3f5e0a217aef2fe8914950fbc5
This commit is contained in:
jmarchel7bulls 2024-05-14 10:16:29 +02:00
parent c4fa56635f
commit 82053168f8
5 changed files with 29 additions and 9 deletions

View File

@ -15,6 +15,7 @@
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="prediction-orchestrator" /> <module name="prediction-orchestrator" />
<module name="predictionorchestrator" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
@ -27,6 +28,7 @@
<component name="JavacSettings"> <component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> <option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="prediction-orchestrator" options="-parameters" /> <module name="prediction-orchestrator" options="-parameters" />
<module name="predictionorchestrator" options="-parameters" />
</option> </option>
</component> </component>
</project> </project>

View File

@ -2,7 +2,6 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.example.prediction-orchestrator.main.iml" filepath="$PROJECT_DIR$/.idea/modules/com.example.prediction-orchestrator.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/prediction-orchestrator.iml" filepath="$PROJECT_DIR$/.idea/prediction-orchestrator.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/prediction-orchestrator.iml" filepath="$PROJECT_DIR$/.idea/prediction-orchestrator.iml" />
</modules> </modules>
</component> </component>

View File

@ -1,13 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4"> <module type="JAVA_MODULE" version="4">
<component name="AdditionalModuleElements"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
</component> <orderEntry type="inheritedJdk" />
<component name="TemplatesService"> <orderEntry type="sourceFolder" forTests="false" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/charts/nebulous-prediction-orchestrator/templates" />
</list>
</option>
</component> </component>
</module> </module>

View File

@ -21,6 +21,11 @@
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.0</version> <!-- Use the latest version available -->
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
@ -31,6 +36,11 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.2</version> <!-- Update to the latest version -->
</dependency>
<dependency> <dependency>
<groupId>eu.nebulouscloud</groupId> <groupId>eu.nebulouscloud</groupId>

View File

@ -48,9 +48,22 @@ public class ApplicationSpecificPredictionConsumer extends Consumer {
String metricName = parts[parts.length - 1]; String metricName = parts[parts.length - 1];
log.debug("Extracted metric name: {}", metricName); // Log the extracted metric name 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; String publisherKey = "predicted_metrics_" + metricName;
PredictedMetricsPublisher predictedMetricsPublisher = (PredictedMetricsPublisher) ctx.getPublisher(publisherKey); 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) { if (predictedMetricsPublisher == null) {
log.info("PredictedMetricsPublisher for metric {} not found, creating a new one.", metricName); log.info("PredictedMetricsPublisher for metric {} not found, creating a new one.", metricName);
predictedMetricsPublisher = new PredictedMetricsPublisher(metricName); predictedMetricsPublisher = new PredictedMetricsPublisher(metricName);