[alerter,webapp] 告警阈值触发表达式优化新增自定义equals函数,告警配置页面完善tip

This commit is contained in:
tomsun28
2021-12-19 10:52:54 +08:00
parent 5f0acb794a
commit cc66efebf3
3 changed files with 91 additions and 22 deletions

View File

@@ -2,7 +2,6 @@ package com.usthe.alert.calculate;
import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.Expression;
import com.usthe.alert.AlerterProperties;
import com.usthe.alert.AlerterWorkerPool;
import com.usthe.alert.AlerterDataQueue;
import com.usthe.alert.entrance.KafkaDataConsume;
@@ -116,7 +115,7 @@ public class CalculateAlarm {
List<CollectRep.Field> fields = metricsData.getFieldsList();
Map<String, Object> fieldValueMap = new HashMap<>(16);
fieldValueMap.put("app", app);
fieldValueMap.put("metric", metrics);
fieldValueMap.put("metrics", metrics);
for (CollectRep.ValueRow valueRow : metricsData.getValuesList()) {
if (!valueRow.getColumnsList().isEmpty()) {
String instance = valueRow.getInstance();
@@ -128,6 +127,7 @@ public class CalculateAlarm {
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
String valueStr = valueRow.getColumns(index);
CollectRep.Field field = fields.get(index);
fieldValueMap.put("metric", field.getName());
if (field.getType() == CommonConstants.TYPE_NUMBER) {
Double doubleValue = CommonUtil.parseDoubleStr(valueStr);
if (doubleValue != null) {