Browse Source

预警逻辑优化处理。。

zhaoxian 4 years ago
parent
commit
17d9a27d86

+ 13 - 3
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -96,6 +96,13 @@ public class MatchLogic {
                     }
                     }
                 }
                 }
             } else {
             } else {
+                /**
+                 不包含逻辑根据指标分两种:
+                 1、大部分数组型指标阈值逻辑:所设的阈值中,存在任一目标则不报警,都不存在时则报警,出现阈值之外的亦报警
+                 2、排除人群包、排除流量包逻辑:所选必须都存在,否则报警
+
+                 包含逻辑通用: 任一存在则报警
+                 */
                 if (value.contains("[") && threshold.contains("[")) {
                 if (value.contains("[") && threshold.contains("[")) {
                     List<String> values = strToList(value);
                     List<String> values = strToList(value);
                     List<String> thresholds = strToList(threshold);
                     List<String> thresholds = strToList(threshold);
@@ -120,13 +127,16 @@ public class MatchLogic {
                                 }
                                 }
                             }
                             }
                         } else {
                         } else {
-                            //不包含,任一存在不报警,都不存在则报警
+                            boolean flag = true;
+                            //不包含,阈值中,存在任一目标则不报警,都不存在时则报警,出现阈值之外的亦报警
                             for (String v : values) {
                             for (String v : values) {
                                 if (threshold.contains(v)) {
                                 if (threshold.contains(v)) {
-                                    return false;
+                                    flag = false;
+                                } else {
+                                    return true;
                                 }
                                 }
                             }
                             }
-                            return true;
+                            return flag;
                         }
                         }
                     }
                     }
                 } else {
                 } else {