diff --git a/slo-violation-detector/src/main/java/configuration/Constants.java b/slo-violation-detector/src/main/java/configuration/Constants.java index 74df36f..aad8dcb 100644 --- a/slo-violation-detector/src/main/java/configuration/Constants.java +++ b/slo-violation-detector/src/main/java/configuration/Constants.java @@ -33,6 +33,7 @@ public class Constants { public static String metric_list_topic = "eu.nebulouscloud.monitoring.metric_list"; public static String topic_prefix_realtime_metrics = "eu.nebulouscloud.monitoring.realtime."; public static String topic_prefix_final_predicted_metrics = "eu.nebulouscloud.monitoring.predicted."; + public static boolean publish_normalized_severity = true; public static double slo_violation_probability_threshold = 0.5; //The threshold over which the probability of a predicted slo violation should be to have a violation detection public static int kept_values_per_metric = 5; //Default to be overriden from the configuration file. This indicates how many metric values are kept to calculate the "previous" metric value during the rate of change calculation public static String roc_calculation_mode = "prototype"; diff --git a/slo-violation-detector/src/main/java/slo_violation_detector_engine/director/DirectorSubcomponent.java b/slo-violation-detector/src/main/java/slo_violation_detector_engine/director/DirectorSubcomponent.java index 8b6ec9c..d2a976b 100644 --- a/slo-violation-detector/src/main/java/slo_violation_detector_engine/director/DirectorSubcomponent.java +++ b/slo-violation-detector/src/main/java/slo_violation_detector_engine/director/DirectorSubcomponent.java @@ -122,8 +122,12 @@ public class DirectorSubcomponent extends SLOViolationDetectorSubcomponent { Clock clock = Clock.systemUTC(); Long current_time_seconds = (long) Math.floor(clock.millis()/1000.0); JSONObject severity_json = new JSONObject(); - severity_json.put("severity", 100); - severity_json.put("probability", 100); + if (publish_normalized_severity){ + severity_json.put("severity", 1.0); + }else{ + severity_json.put("severity", 100.0); + } + severity_json.put("probability", 100.0); severity_json.put("predictionTime", current_time_seconds); persistent_publisher.publish(severity_json.toJSONString(), Collections.singleton(EMPTY)); diff --git a/slo-violation-detector/src/main/java/slo_violation_detector_engine/generic/Runnables.java b/slo-violation-detector/src/main/java/slo_violation_detector_engine/generic/Runnables.java index b1b1889..c835ab4 100644 --- a/slo-violation-detector/src/main/java/slo_violation_detector_engine/generic/Runnables.java +++ b/slo-violation-detector/src/main/java/slo_violation_detector_engine/generic/Runnables.java @@ -157,7 +157,11 @@ public class Runnables { if (slo_violation_probability >= slo_violation_probability_threshold) { JSONObject severity_json = new JSONObject(); - severity_json.put("severity", rule_severity); + if (publish_normalized_severity) { + severity_json.put("severity", rule_severity/100); + }else{ + severity_json.put("severity", rule_severity); + } severity_json.put("probability", slo_violation_probability); severity_json.put("predictionTime", targeted_prediction_time); finalPersistent_publisher.publish(severity_json.toJSONString(), Collections.singleton(detector.get_application_name()));