From 873a0d1da45b0d52852af91be5e7daff086fd1f3 Mon Sep 17 00:00:00 2001 From: Andreas Tsagkaropoulos Date: Thu, 10 Jun 2021 16:22:31 +0300 Subject: [PATCH 1/4] Handle the case in which NaN is generated as a severity value (for example when square root of a negative severity sum is calculated) --- .../src/main/java/utilities/SLOViolationCalculator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 69f0f9ca..7612af2e 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 { -- GitLab From 32bec345179716bcdb170fa8ffb5d8cf38b87332 Mon Sep 17 00:00:00 2001 From: Andreas Tsagkaropoulos Date: Tue, 15 Jun 2021 14:12:57 +0300 Subject: [PATCH 2/4] Library version update --- amq-message-java-library/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amq-message-java-library/pom.xml b/amq-message-java-library/pom.xml index 25044787..75f5cc13 100644 --- a/amq-message-java-library/pom.xml +++ b/amq-message-java-library/pom.xml @@ -19,7 +19,7 @@ amq-message-java-library AMQ message Java library gr.ntua.imu.morphemic - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT -- GitLab From 1d64109fe10ef3d1201cc78501b6e68f60a97ec0 Mon Sep 17 00:00:00 2001 From: Andreas Tsagkaropoulos Date: Tue, 15 Jun 2021 14:29:03 +0300 Subject: [PATCH 3/4] Improved naming of some methods and of a field Improved processing of delayed predictions Implemented mechanism to remove data which is leftover from previous predictions Cleanup of pom.xml file --- morphemic-slo-severity-calculator/pom.xml | 23 +++------ .../AttributeSubscription.java | 18 +++---- .../src/main/java/runtime/Main.java | 47 ++++++++++++++----- .../src/main/java/slo_processing/SLORule.java | 6 +-- .../main/java/slo_processing/SLOSubRule.java | 6 +-- .../PredictedMonitoringAttribute.java | 3 +- .../java/DerivedMonitoringAttributeTests.java | 2 +- .../src/test/java/SeverityTests.java | 6 +-- .../UnboundedMonitoringAttributeTests.java | 5 +- 9 files changed, 64 insertions(+), 52 deletions(-) diff --git a/morphemic-slo-severity-calculator/pom.xml b/morphemic-slo-severity-calculator/pom.xml index 36a7df4d..bfe193bd 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 - 9 - - org.apache.maven.plugins maven-compiler-plugin @@ -46,11 +37,17 @@ 11 11 + 3.8.1 + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + maven-deploy-plugin 2.8.1 @@ -72,7 +69,7 @@ gr.ntua.imu.morphemic amq-message-java-library - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT com.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 f7fcfca3..20910c89 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 e6cb019d..8c1476af 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 6fea56ce..67cc6357 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 cfe989f4..2d252e08 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/utility_beans/PredictedMonitoringAttribute.java b/morphemic-slo-severity-calculator/src/main/java/utility_beans/PredictedMonitoringAttribute.java index 2d9ed65b..3a80f8bb 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 1dc8c595..5e8f8712 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 c5c0790b..2d5df847 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 d3cd7f98..c313ecf3 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); -- GitLab From be218a1d5a022bd543df69719b4901ea9025932e Mon Sep 17 00:00:00 2001 From: Andreas Tsagkaropoulos Date: Wed, 16 Jun 2021 13:06:36 +0300 Subject: [PATCH 4/4] Update of the build script for the slo-severity-calculator, to ignore a test which requires an external publisher, during the build of the component --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da6bfe3e..856c500a 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/ -- GitLab