diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index da6bfe3e9a2fc41ca701c701b3345a938d109578..856c500aa8d162441cc5044d3dde5bd2fc7c0ea6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -57,7 +57,7 @@ build:slo-severity-calculator:
stage: build
image: $MAVEN_IMAGE
script:
- - $SLO_SEVERITY_CALCULATOR_CLI clean install
+ - $SLO_SEVERITY_CALCULATOR_CLI -Dtest=!UnboundedMonitoringAttributeTests clean install
artifacts:
paths:
- /builds/melodic/morphemic-preprocessor/maven_repo/gr/ntua/imu/morphemic/SLOSeverityCalculator/
diff --git a/amq-message-java-library/pom.xml b/amq-message-java-library/pom.xml
index 25044787e0834e4373717add0fa68115dc502739..75f5cc137b8f478bc0f962da02cf72033770935d 100644
--- a/amq-message-java-library/pom.xml
+++ b/amq-message-java-library/pom.xml
@@ -19,7 +19,7 @@
amq-message-java-libraryAMQ message Java librarygr.ntua.imu.morphemic
- 1.1.0-SNAPSHOT
+ 1.1.1-SNAPSHOT
diff --git a/morphemic-slo-severity-calculator/pom.xml b/morphemic-slo-severity-calculator/pom.xml
index 36a7df4dcfa11e2e0a71ae8ebd294fce1540b1cf..bfe193bdbf2cd451f6369c4f4083cf698c1f2889 100644
--- a/morphemic-slo-severity-calculator/pom.xml
+++ b/morphemic-slo-severity-calculator/pom.xml
@@ -30,15 +30,6 @@
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 9
-
- org.apache.maven.pluginsmaven-compiler-plugin
@@ -46,11 +37,17 @@
11
+ 3.8.1
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0-M5
+ maven-deploy-plugin2.8.1
@@ -72,7 +69,7 @@
gr.ntua.imu.morphemicamq-message-java-library
- 1.1.0-SNAPSHOT
+ 1.1.1-SNAPSHOTcom.googlecode.json-simple
@@ -87,12 +84,6 @@
provided
-
- org.apache.commons
- commons-lang3
- 3.8.1
-
-
javax.jms
diff --git a/morphemic-slo-severity-calculator/src/main/java/metric_retrieval/AttributeSubscription.java b/morphemic-slo-severity-calculator/src/main/java/metric_retrieval/AttributeSubscription.java
index f7fcfca3150bba520ee956ab12cb1480fe87785a..20910c89a9d7cf5a616e4ace0c406f3604bcf30d 100644
--- a/morphemic-slo-severity-calculator/src/main/java/metric_retrieval/AttributeSubscription.java
+++ b/morphemic-slo-severity-calculator/src/main/java/metric_retrieval/AttributeSubscription.java
@@ -18,8 +18,7 @@ import java.util.function.BiFunction;
import java.util.logging.Logger;
import static configuration.Constants.*;
-import static runtime.Main.PREDICTION_EXISTS;
-import static runtime.Main.running_threads;
+import static runtime.Main.*;
import static utility_beans.PredictedMonitoringAttribute.getPredicted_monitoring_attributes;
import static utility_beans.RealtimeMonitoringAttribute.update_monitoring_attribute_value;
@@ -68,7 +67,7 @@ public class AttributeSubscription {
- String forecasted_metric_topic_name = "prediction."+metric;
+ String forecasted_metric_topic_name = TopicNames.final_metric_predictions_topic(metric);
Logger.getAnonymousLogger().log(info_logging_level,"Starting forecasted metric subscription at "+forecasted_metric_topic_name);
BrokerSubscriber forecasted_subscriber = new BrokerSubscriber(forecasted_metric_topic_name, broker_ip_address,broker_username,broker_password, amq_library_configuration_location);
@@ -98,15 +97,16 @@ public class AttributeSubscription {
Main.PREDICTION_EXISTS.notifyAll();
}
}
- //predicted_attributes.get(predicted_attribute_name).clear();
- for (SLOSubRule subrule : SLOSubRule.getSlo_subrules().get(predicted_attribute_name)) {
+
+ for (SLOSubRule subrule : SLOSubRule.getSlo_subrules_per_monitoring_attribute().get(predicted_attribute_name)) { //Get the subrules which are associated to the monitoring attribute which is predicted, and perform the following processing to each one of them
+
getPredicted_monitoring_attributes().computeIfAbsent(subrule.getId(), k -> new HashMap<>());
- if ( (getPredicted_monitoring_attributes().get(subrule.getId()).get(targeted_prediction_time)!=null) &&(getPredicted_monitoring_attributes().get(subrule.getId()).get(targeted_prediction_time).getTimestamp()>timestamp)){
- //do nothing, as in this case an older prediction has arrived for a metric delayed, and so it should be disregarded
+ //if ( (getPredicted_monitoring_attributes().get(subrule.getId()).get(targeted_prediction_time)!=null) &&(getPredicted_monitoring_attributes().get(subrule.getId()).get(targeted_prediction_time).getTimestamp()>timestamp)){
+ if (last_processed_adaptation_time>=targeted_prediction_time){
+ //Do nothing, as in this case the targeted prediction time of the 'new' prediction is older than or equal to the last processed adaptation timepoint. This means that this prediction has arrived delayed, and so it should be disregarded
}else {
- PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute(predicted_attribute_name, subrule.isGreaterThanRule(), subrule.getThreshold(), subrule.getId(), forecasted_value, probability_confidence, confidence_interval, targeted_prediction_time);
+ PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute(predicted_attribute_name, subrule.isGreaterThanRule(), subrule.getThreshold(), subrule.getId(), forecasted_value, probability_confidence, confidence_interval,timestamp, targeted_prediction_time);
- //predicted_attributes.get(predicted_attribute_name).add(prediction_attribute);
subrule.setAssociated_predicted_monitoring_attribute(prediction_attribute);
getPredicted_monitoring_attributes().get(subrule.getId()).put(targeted_prediction_time, prediction_attribute);
diff --git a/morphemic-slo-severity-calculator/src/main/java/runtime/Main.java b/morphemic-slo-severity-calculator/src/main/java/runtime/Main.java
index e6cb019d85d662f3ea5b056cbbb7e2a32f56f3fc..8c1476af1d889c5fda7bb76c42b43a4a77bbeaae 100644
--- a/morphemic-slo-severity-calculator/src/main/java/runtime/Main.java
+++ b/morphemic-slo-severity-calculator/src/main/java/runtime/Main.java
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
import static configuration.Constants.*;
import static java.lang.Thread.sleep;
import static slo_processing.SLORule.process_rule_value;
+import static utility_beans.PredictedMonitoringAttribute.getPredicted_monitoring_attributes;
import static utility_beans.RealtimeMonitoringAttribute.getMonitoring_attributes_bounds_representation;
public class Main {
@@ -40,6 +41,8 @@ public class Main {
public static ArrayList slo_rules = new ArrayList<>();
public static HashMap running_threads = new HashMap<>();
public static CircularFifoQueue adaptation_times = new CircularFifoQueue<>();
+ private static HashSet adaptation_times_to_remove = new HashSet<>();
+ public static Long last_processed_adaptation_time = -1L;//initialization
public static final SynchronizedBoolean can_modify_slo_rules = new SynchronizedBoolean(false);
private static Properties prop = new Properties();
@@ -225,9 +228,9 @@ public class Main {
}
can_modify_slo_rules.setValue(false);
for (SLORule slo_rule : slo_rules) {
- for (SLOSubRule subrule : SLORule.get_subrules(slo_rule.getRule_representation())) {
- SLOSubRule.getSlo_subrules().computeIfAbsent(subrule.getMetric(), k -> new ArrayList<>());
- SLOSubRule.getSlo_subrules().get(subrule.getMetric()).add(subrule);
+ for (SLOSubRule subrule : SLORule.parse_subrules(slo_rule.getRule_representation())) {
+ SLOSubRule.getSlo_subrules_per_monitoring_attribute().computeIfAbsent(subrule.getMetric(), k -> new ArrayList<>());
+ SLOSubRule.getSlo_subrules_per_monitoring_attribute().get(subrule.getMetric()).add(subrule);
}
}
can_modify_slo_rules.setValue(true);
@@ -318,8 +321,8 @@ public class Main {
RealtimeMonitoringAttribute.update_monitoring_attribute_value("cpu",cpu_value);
RealtimeMonitoringAttribute.update_monitoring_attribute_value("ram",ram_value);
- PredictedMonitoringAttribute cpuPredictionAttribute = new PredictedMonitoringAttribute("cpu",true, 70,1, 90.0,80,10,System.currentTimeMillis()+10000);
- PredictedMonitoringAttribute ramPredictionAttribute = new PredictedMonitoringAttribute("ram",true, 50,2, 70.0,80,10,System.currentTimeMillis()+10000);
+ PredictedMonitoringAttribute cpuPredictionAttribute = new PredictedMonitoringAttribute("cpu",true, 70,1, 90.0,80,10,System.currentTimeMillis(),System.currentTimeMillis()+10000);
+ PredictedMonitoringAttribute ramPredictionAttribute = new PredictedMonitoringAttribute("ram",true, 50,2, 70.0,80,10,System.currentTimeMillis(),System.currentTimeMillis()+10000);
PredictionAttributeSet predictionAttributeSet = new PredictionAttributeSet(new ArrayList<>(){{add(cpuPredictionAttribute);add(ramPredictionAttribute);}});
@@ -381,8 +384,8 @@ public class Main {
//Get prediction_attribute_sets and calculate method 1 on top of them
//Get individual prediction_attributes and calculate method 2 on top of them
- PredictedMonitoringAttribute cpuPredictionAttribute = new PredictedMonitoringAttribute("cpu",true, 70,1, 90.0,80,10,System.currentTimeMillis()+10000);
- PredictedMonitoringAttribute ramPredictionAttribute = new PredictedMonitoringAttribute("ram",true, 50,2, 70.0,80,10,System.currentTimeMillis()+10000);
+ PredictedMonitoringAttribute cpuPredictionAttribute = new PredictedMonitoringAttribute("cpu",true, 70,1, 90.0,80,10,System.currentTimeMillis(),System.currentTimeMillis()+10000);
+ PredictedMonitoringAttribute ramPredictionAttribute = new PredictedMonitoringAttribute("ram",true, 50,2, 70.0,80,10,System.currentTimeMillis(),System.currentTimeMillis()+10000);
PredictionAttributeSet predictionAttributeSet = new PredictionAttributeSet(new ArrayList<>(){{add(cpuPredictionAttribute);add(ramPredictionAttribute);}});
@@ -427,12 +430,13 @@ public class Main {
}
try {
+ clean_data(adaptation_times_to_remove);
Clock clock = Clock.systemUTC();
Long current_time = clock.millis();
Long targeted_prediction_time = adaptation_times.stream().min(Long::compare).get();
Logger.getAnonymousLogger().log(info_logging_level,"Targeted_prediction_time "+targeted_prediction_time);
- adaptation_times.remove(targeted_prediction_time);
+ adaptation_times.remove(targeted_prediction_time);//remove from the list of timepoints which should be processed. Later this timepoint will be added to the adaptation_times_to_remove HashSet to remove any data associated with it
synchronized (PREDICTION_EXISTS) {
PREDICTION_EXISTS.setValue(adaptation_times.size() > 0);
}
@@ -447,16 +451,20 @@ public class Main {
double rule_severity = process_rule_value(rule.getRule_representation(),targeted_prediction_time);
double slo_violation_probability = determine_slo_violation_probability(rule_severity);
Logger.getAnonymousLogger().log(info_logging_level,"The overall " + slo_violation_determination_method + " severity - calculated from real data - for adaptation time "+targeted_prediction_time+" ( "+(new Date((new Timestamp(targeted_prediction_time*1000)).getTime()))+" ) is " + rule_severity + " and is calculated "+time_horizon_seconds+" seconds beforehand");
- Logger.getAnonymousLogger().log(info_logging_level,"The probability of an SLO violation is "+((int)(slo_violation_probability*100))/100.0+"%");
+ Logger.getAnonymousLogger().log(info_logging_level,"The probability of an SLO violation is "+((int)(slo_violation_probability*100))+"%");
JSONObject severity_json = new JSONObject();
severity_json.put("severity",rule_severity);
severity_json.put("slo_violation_probability",slo_violation_probability);
persistent_publisher.publish(severity_json.toJSONString());
- } catch (InterruptedException | NoSuchElementException e) {
- Logger.getAnonymousLogger().log(info_logging_level,"Severity calculation thread interrupted, stopping...");
+ adaptation_times_to_remove.add(targeted_prediction_time); //This line serves a different purpose from the adaptation_times.remove(...) directive above, as the adaptation_times_to_remove HashSet contains timepoints which should be processed to delete their data.
+ } catch (InterruptedException i) {
+ Logger.getAnonymousLogger().log(severe_logging_level,"Severity calculation thread interrupted, stopping...");
running_threads.remove("severity_calculation_thread_"+rule.toString());
return;
+ } catch (NoSuchElementException n){
+ Logger.getAnonymousLogger().log(warning_logging_level,"Could not calculate severity as a value was missing...");
+ continue;
}
}
running_threads.remove("severity_calculation_thread_"+rule.toString());
@@ -471,6 +479,19 @@ public class Main {
//return slo_processors;
}
+ private static void clean_data(HashSet adaptation_times_to_remove) {
+ for (Long processed_adaptation_time:adaptation_times_to_remove){
+ if (processed_adaptation_time>last_processed_adaptation_time){
+ last_processed_adaptation_time = processed_adaptation_time;
+ }
+ for (SLORule slo_rule: slo_rules) {
+ for (SLOSubRule subrule : slo_rule.getSlo_subrules()) {
+ getPredicted_monitoring_attributes().get(subrule.getId()).remove(processed_adaptation_time);
+ }
+ }
+ }
+ }
+
/**
* This function determines the probability of an SLO violation
* @param rule_severity The severity of the rule which has been determined
@@ -480,8 +501,8 @@ public class Main {
if (slo_violation_determination_method.equals("all-metrics")) {
//39.64 is the mean severity value when examining all integer severity values for roc x probability x confidence_interval x delta_value in (-100,100)x(0,100)x(0,100)x(-100,100)
if (rule_severity >= 39.64) {
- return 50 + 100*(rule_severity - 39.64) / 120.72; // in case we desire the probability to start from 50%
- // return 100*(rule_severity - 39.64) / 60.36; // in case we desire the probability to start from 0%
+ return Math.min((50 + 100*(rule_severity - 39.64) / 120.72)/100,1); // in case we desire the probability to start from 50%
+ // return Math.min((100*(rule_severity - 39.64) / 60.36)/100,1); // in case we desire the probability to start from 0%
} else {
return 0;
}
diff --git a/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLORule.java b/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLORule.java
index 6fea56ce5db2953c0e97e73d7186afe69b5a5e5d..67cc63575b90b09809dbeac76eca73e5cb7c24b8 100644
--- a/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLORule.java
+++ b/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLORule.java
@@ -39,14 +39,14 @@ public class SLORule {
}
}
- public static ArrayList get_subrules(JSONObject rule_json){
+ public static ArrayList parse_subrules(JSONObject rule_json){
ArrayList subrules = new ArrayList<>(); //initialization
String rule_id = (String) rule_json.get("id");
if (is_composite_rule(rule_id)) {
JSONArray subrules_json_array = (JSONArray) rule_json.get(rule_id);
for (Object subrule : subrules_json_array) {
JSONObject json_subrule = (JSONObject) subrule;
- subrules.addAll(get_subrules(json_subrule));
+ subrules.addAll(parse_subrules(json_subrule));
}
}else{
String id = (String) rule_json.get("id");
@@ -153,7 +153,7 @@ public class SLORule {
}
- private ArrayList getSlo_subrules() {
+ public ArrayList getSlo_subrules() {
return slo_subrules;
}
}
diff --git a/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLOSubRule.java b/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLOSubRule.java
index cfe989f460030bc1b49bc71172938d3c1779a5b4..2d252e08141aa5be27b67d62691c0de59fd84668 100644
--- a/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLOSubRule.java
+++ b/morphemic-slo-severity-calculator/src/main/java/slo_processing/SLOSubRule.java
@@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.HashMap;
public class SLOSubRule {
- private static HashMap> slo_subrules = new HashMap<>();
+ private static HashMap> slo_subrules_per_monitoring_attribute = new HashMap<>();
private String metric;
private String operator;
private SLORuleJoin rule_join_type;
@@ -42,8 +42,8 @@ public class SLOSubRule {
return id;
}
- public static HashMap> getSlo_subrules() {
- return slo_subrules;
+ public static HashMap> getSlo_subrules_per_monitoring_attribute() {
+ return slo_subrules_per_monitoring_attribute;
}
public PredictedMonitoringAttribute getAssociated_predicted_monitoring_attribute() {
diff --git a/morphemic-slo-severity-calculator/src/main/java/utilities/SLOViolationCalculator.java b/morphemic-slo-severity-calculator/src/main/java/utilities/SLOViolationCalculator.java
index 69f0f9ca36a51df1f5cd345e17ae8e73a7186b3d..7612af2e1d469ca8a7867a6367d24a7c218a3e77 100644
--- a/morphemic-slo-severity-calculator/src/main/java/utilities/SLOViolationCalculator.java
+++ b/morphemic-slo-severity-calculator/src/main/java/utilities/SLOViolationCalculator.java
@@ -34,8 +34,8 @@ public class SLOViolationCalculator {
Logger.getAnonymousLogger().log(info_logging_level,"The all-metrics attribute severity for " + predictionAttribute.getName() + " based on a (roc,prconf,normalized_interval,delta) quadraplet of (" + predictionAttribute.getRate_of_change() + "," + predictionAttribute.getProbability_confidence()+ "," + predictionAttribute.getNormalizedConfidenceIntervalWidth()+","+predictionAttribute.getDelta() + ") is " + all_metrics_method_attribute_severity);
- if (all_metrics_method_attribute_severity<0){
- Logger.getAnonymousLogger().log(warning_logging_level,"negative severity produced: "+all_metrics_method_attribute_severity+" using 0 instead");
+ if (Double.isNaN(all_metrics_method_attribute_severity) || ( all_metrics_method_attribute_severity<0)){
+ Logger.getAnonymousLogger().log(warning_logging_level,"Negative or NaN severity produced: "+all_metrics_method_attribute_severity+" using 0 instead");
return 0;
}
else {
diff --git a/morphemic-slo-severity-calculator/src/main/java/utility_beans/PredictedMonitoringAttribute.java b/morphemic-slo-severity-calculator/src/main/java/utility_beans/PredictedMonitoringAttribute.java
index 2d9ed65b3bb4479ef48993180528d5229f0ff806..3a80f8bb04e8c996a0822a9c556713a90c134c6a 100644
--- a/morphemic-slo-severity-calculator/src/main/java/utility_beans/PredictedMonitoringAttribute.java
+++ b/morphemic-slo-severity-calculator/src/main/java/utility_beans/PredictedMonitoringAttribute.java
@@ -33,7 +33,7 @@ public class PredictedMonitoringAttribute {
public PredictedMonitoringAttribute(String name){
this.name = name;
}
- public PredictedMonitoringAttribute(String name, boolean greater_than_rule, double threshold, int associated_subrule_id, Double forecasted_value, double probability_confidence, double confidence_interval_width, long targeted_prediction_time){
+ public PredictedMonitoringAttribute(String name, boolean greater_than_rule, double threshold, int associated_subrule_id, Double forecasted_value, double probability_confidence, double confidence_interval_width,long timestamp, long targeted_prediction_time){
//Below, it is assumed that the maximum of an attribute is 100, and the minimum of an attribute is 0
this.initialized = true;
@@ -86,6 +86,7 @@ public class PredictedMonitoringAttribute {
this.confidence_interval_width = confidence_interval_width;
//actual_metric_values = get_last_n_actual_values(Constants.elements_considered_in_prediction, MonitoringAttribute.get_monitoring_attributes_values_map().get(name),true);
this.associated_subrule_id = associated_subrule_id;
+ this.timestamp = timestamp;
this.targeted_prediction_time = targeted_prediction_time;
}
diff --git a/morphemic-slo-severity-calculator/src/test/java/DerivedMonitoringAttributeTests.java b/morphemic-slo-severity-calculator/src/test/java/DerivedMonitoringAttributeTests.java
index 1dc8c595a07e7395fee11651ea40e9ef5957190b..5e8f87126d33bad0d14ac7299076cef02bdef7b9 100644
--- a/morphemic-slo-severity-calculator/src/test/java/DerivedMonitoringAttributeTests.java
+++ b/morphemic-slo-severity-calculator/src/test/java/DerivedMonitoringAttributeTests.java
@@ -22,7 +22,7 @@ public class DerivedMonitoringAttributeTests {
getAttributes_maximum_rate_of_change().put("cpu",roc_limit);
getAttributes_minimum_rate_of_change().put("cpu",-roc_limit);
- PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,70,1,100.0,100,1,System.currentTimeMillis()+20000);
+ PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,70,1,100.0,100,1,System.currentTimeMillis(),System.currentTimeMillis()+20000);
assert prediction_attribute.getRate_of_change() == 100.0;
}
diff --git a/morphemic-slo-severity-calculator/src/test/java/SeverityTests.java b/morphemic-slo-severity-calculator/src/test/java/SeverityTests.java
index c5c0790b2c2c1ee0c5abddea218eb2c31d59066f..2d5df84780f6bf1c6573f5ec59eac272e4ab766b 100644
--- a/morphemic-slo-severity-calculator/src/test/java/SeverityTests.java
+++ b/morphemic-slo-severity-calculator/src/test/java/SeverityTests.java
@@ -25,7 +25,7 @@ public class SeverityTests {
}
RealtimeMonitoringAttribute.update_monitoring_attribute_value("cpu",0.0);
- PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,70,1,100.0,100,10,System.currentTimeMillis()+20000);
+ PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,70,1,100.0,100,10,System.currentTimeMillis(),System.currentTimeMillis()+20000);
assert (prediction_attribute.getRate_of_change() < 100.0000000001 && prediction_attribute.getRate_of_change()>99.9999999999); //maximum value
assert (prediction_attribute.getConfidence_interval_width() <10.000000000001 && prediction_attribute.getConfidence_interval_width()>9.9999999999);
@@ -50,7 +50,7 @@ public class SeverityTests {
}
RealtimeMonitoringAttribute.update_monitoring_attribute_value("cpu",30.0);
- PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,70,1,80.0,90,5,System.currentTimeMillis()+20000);
+ PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,70,1,80.0,90,5,System.currentTimeMillis(),System.currentTimeMillis()+20000);
assert (prediction_attribute.getRate_of_change() > 99.99999999 && prediction_attribute.getRate_of_change()< 100.00000001); //zero value
assert (prediction_attribute.getConfidence_interval_width() <5.000000000001 && prediction_attribute.getConfidence_interval_width()>4.9999999999);
@@ -75,7 +75,7 @@ public class SeverityTests {
}
RealtimeMonitoringAttribute.update_monitoring_attribute_value("cpu",86.0);
- PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,75,1,92.0,88,7.8,System.currentTimeMillis()+20000);
+ PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute("cpu",true,75,1,92.0,88,7.8,System.currentTimeMillis(),System.currentTimeMillis()+20000);
assert (prediction_attribute.getRate_of_change()> 6.97674418604 && prediction_attribute.getRate_of_change()< 6.97674418605 ); //zero value
assert (prediction_attribute.getConfidence_interval_width() >7.7999999 && prediction_attribute.getConfidence_interval_width()<7.8000001);
diff --git a/morphemic-slo-severity-calculator/src/test/java/UnboundedMonitoringAttributeTests.java b/morphemic-slo-severity-calculator/src/test/java/UnboundedMonitoringAttributeTests.java
index d3cd7f98f183930d72124107ae31df58ef8beb67..c313ecf3aa6722033dd8d5919c88e16784735495 100644
--- a/morphemic-slo-severity-calculator/src/test/java/UnboundedMonitoringAttributeTests.java
+++ b/morphemic-slo-severity-calculator/src/test/java/UnboundedMonitoringAttributeTests.java
@@ -1,7 +1,6 @@
import eu.melodic.event.brokerclient.BrokerSubscriber;
import eu.melodic.event.brokerclient.templates.EventFields;
import eu.melodic.event.brokerclient.templates.TopicNames;
-import org.apache.commons.lang3.mutable.MutableBoolean;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -127,12 +126,12 @@ public class UnboundedMonitoringAttributeTests {
}
}
//predicted_attributes.get(predicted_attribute_name).clear();
- for (SLOSubRule subrule : SLOSubRule.getSlo_subrules().get(predicted_attribute_name)) {
+ for (SLOSubRule subrule : SLOSubRule.getSlo_subrules_per_monitoring_attribute().get(predicted_attribute_name)) {
getPredicted_monitoring_attributes().computeIfAbsent(subrule.getId(), k -> new HashMap<>());
if ( (getPredicted_monitoring_attributes().get(subrule.getId()).get(targeted_prediction_time)!=null) &&(getPredicted_monitoring_attributes().get(subrule.getId()).get(targeted_prediction_time).getTimestamp()>timestamp)){
//do nothing, as in this case an older prediction has arrived for a metric delayed, and so it should be disregarded
}else {
- PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute(predicted_attribute_name, subrule.isGreaterThanRule(), subrule.getThreshold(), subrule.getId(), forecasted_value, probability_confidence, confidence_interval, targeted_prediction_time);
+ PredictedMonitoringAttribute prediction_attribute = new PredictedMonitoringAttribute(predicted_attribute_name, subrule.isGreaterThanRule(), subrule.getThreshold(), subrule.getId(), forecasted_value, probability_confidence, confidence_interval, timestamp,targeted_prediction_time);
//predicted_attributes.get(predicted_attribute_name).add(prediction_attribute);
subrule.setAssociated_predicted_monitoring_attribute(prediction_attribute);