|
15 | 15 | * limitations under the License.
|
16 | 16 | */
|
17 | 17 |
|
18 |
| -package org.dromara.hertzbeat.alert.calculate; |
| 18 | +package org.apache.hertzbeat.alert.calculate; |
19 | 19 |
|
20 | 20 | import com.googlecode.aviator.AviatorEvaluator;
|
21 | 21 | import com.googlecode.aviator.Expression;
|
|
24 | 24 | import com.googlecode.aviator.exception.ExpressionSyntaxErrorException;
|
25 | 25 | import lombok.extern.slf4j.Slf4j;
|
26 | 26 | import org.apache.commons.lang3.StringUtils;
|
27 |
| -import org.dromara.hertzbeat.alert.AlerterWorkerPool; |
28 |
| -import org.dromara.hertzbeat.alert.dao.AlertMonitorDao; |
29 |
| -import org.dromara.hertzbeat.alert.reduce.AlarmCommonReduce; |
30 |
| -import org.dromara.hertzbeat.alert.service.AlertDefineService; |
31 |
| -import org.dromara.hertzbeat.alert.service.AlertService; |
32 |
| -import org.dromara.hertzbeat.alert.util.AlertTemplateUtil; |
33 |
| -import org.dromara.hertzbeat.common.constants.CommonConstants; |
34 |
| -import org.dromara.hertzbeat.common.entity.alerter.Alert; |
35 |
| -import org.dromara.hertzbeat.common.entity.alerter.AlertDefine; |
36 |
| -import org.dromara.hertzbeat.common.entity.manager.Monitor; |
37 |
| -import org.dromara.hertzbeat.common.entity.manager.TagItem; |
38 |
| -import org.dromara.hertzbeat.common.entity.message.CollectRep; |
39 |
| -import org.dromara.hertzbeat.common.queue.CommonDataQueue; |
40 |
| -import org.dromara.hertzbeat.common.support.event.MonitorDeletedEvent; |
41 |
| -import org.dromara.hertzbeat.common.support.event.SystemConfigChangeEvent; |
42 |
| -import org.dromara.hertzbeat.common.util.CommonUtil; |
43 |
| -import org.dromara.hertzbeat.common.util.ResourceBundleUtil; |
| 27 | +import org.apache.hertzbeat.alert.AlerterWorkerPool; |
| 28 | +import org.apache.hertzbeat.alert.service.AlertDefineService; |
| 29 | +import org.apache.hertzbeat.alert.dao.AlertMonitorDao; |
| 30 | +import org.apache.hertzbeat.alert.reduce.AlarmCommonReduce; |
| 31 | +import org.apache.hertzbeat.alert.service.AlertService; |
| 32 | +import org.apache.hertzbeat.alert.util.AlertTemplateUtil; |
| 33 | +import org.apache.hertzbeat.common.constants.CommonConstants; |
| 34 | +import org.apache.hertzbeat.common.entity.alerter.Alert; |
| 35 | +import org.apache.hertzbeat.common.entity.alerter.AlertDefine; |
| 36 | +import org.apache.hertzbeat.common.entity.manager.Monitor; |
| 37 | +import org.apache.hertzbeat.common.entity.manager.TagItem; |
| 38 | +import org.apache.hertzbeat.common.entity.message.CollectRep; |
| 39 | +import org.apache.hertzbeat.common.queue.CommonDataQueue; |
| 40 | +import org.apache.hertzbeat.common.support.event.MonitorDeletedEvent; |
| 41 | +import org.apache.hertzbeat.common.support.event.SystemConfigChangeEvent; |
| 42 | +import org.apache.hertzbeat.common.util.CommonUtil; |
| 43 | +import org.apache.hertzbeat.common.util.ResourceBundleUtil; |
44 | 44 | import org.springframework.context.event.EventListener;
|
45 | 45 | import org.springframework.data.jpa.domain.Specification;
|
46 | 46 | import org.springframework.stereotype.Component;
|
|
51 | 51 | import java.util.concurrent.ConcurrentHashMap;
|
52 | 52 | import java.util.stream.Collectors;
|
53 | 53 |
|
54 |
| -import static org.dromara.hertzbeat.common.constants.CommonConstants.*; |
| 54 | +import static org.apache.hertzbeat.common.constants.CommonConstants.*; |
55 | 55 |
|
56 | 56 | /**
|
57 | 57 | * Calculate alarms based on the alarm definition rules and collected data
|
58 |
| - * |
59 | 58 | */
|
60 | 59 | @Component
|
61 | 60 | @Slf4j
|
@@ -283,8 +282,8 @@ private void afterThresholdRuleMatch(long currentTimeMilli, long monitorId, Stri
|
283 | 282 | fieldValueMap.put(TAG_METRICS, metrics);
|
284 | 283 | fieldValueMap.put(TAG_METRIC, define.getField());
|
285 | 284 | Map<String, String> tags = new HashMap<>(8);
|
286 |
| - tags.put(CommonConstants.TAG_MONITOR_ID, String.valueOf(monitorId)); |
287 |
| - tags.put(CommonConstants.TAG_MONITOR_APP, app); |
| 285 | + tags.put(TAG_MONITOR_ID, String.valueOf(monitorId)); |
| 286 | + tags.put(TAG_MONITOR_APP, app); |
288 | 287 | tags.put(CommonConstants.TAG_THRESHOLD_ID, String.valueOf(define.getId()));
|
289 | 288 | if (!CollectionUtils.isEmpty(define.getTags())) {
|
290 | 289 | for (TagItem tagItem : define.getTags()) {
|
@@ -351,8 +350,8 @@ private void handlerAvailableMetrics(long monitorId, String app, CollectRep.Metr
|
351 | 350 | if (metricsData.getCode() != CollectRep.Code.SUCCESS) {
|
352 | 351 | Alert preAlert = triggeredAlertMap.get(String.valueOf(monitorId));
|
353 | 352 | Map<String, String> tags = new HashMap<>(6);
|
354 |
| - tags.put(CommonConstants.TAG_MONITOR_ID, String.valueOf(monitorId)); |
355 |
| - tags.put(CommonConstants.TAG_MONITOR_APP, app); |
| 353 | + tags.put(TAG_MONITOR_ID, String.valueOf(monitorId)); |
| 354 | + tags.put(TAG_MONITOR_APP, app); |
356 | 355 | tags.put(CommonConstants.TAG_THRESHOLD_ID, String.valueOf(avaAlertDefine.getId()));
|
357 | 356 | tags.put(TAG_METRICS, CommonConstants.AVAILABILITY);
|
358 | 357 | tags.put(TAG_CODE, metricsData.getCode().name());
|
|
0 commit comments