From 2246988aff3eb317a6322b7d46f547f0fda86b53 Mon Sep 17 00:00:00 2001 From: linyunlong Date: Sat, 24 Aug 2024 17:54:34 +0800 Subject: [PATCH] [alerter]optimize: Append not resolved alert description to resolved alert --- .../apache/hertzbeat/alert/calculate/CalculateAlarm.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alerter/src/main/java/org/apache/hertzbeat/alert/calculate/CalculateAlarm.java b/alerter/src/main/java/org/apache/hertzbeat/alert/calculate/CalculateAlarm.java index ec75b4c5146..3b2d81b2b28 100644 --- a/alerter/src/main/java/org/apache/hertzbeat/alert/calculate/CalculateAlarm.java +++ b/alerter/src/main/java/org/apache/hertzbeat/alert/calculate/CalculateAlarm.java @@ -177,7 +177,7 @@ private void calculate(CollectRep.MetricsData metricsData) { String alarmKey = String.valueOf(monitorId) + define.getId(); triggeredAlertMap.remove(alarmKey); if (define.isRecoverNotice()) { - handleRecoveredAlert(currentTimeMilli, define, expr, alarmKey); + handleRecoveredAlert(currentTimeMilli, define, alarmKey); } } } catch (Exception e) { @@ -232,7 +232,7 @@ private void calculate(CollectRep.MetricsData metricsData) { String alarmKey = String.valueOf(monitorId) + define.getId() + tagBuilder; triggeredAlertMap.remove(alarmKey); if (define.isRecoverNotice()) { - handleRecoveredAlert(currentTimeMilli, define, expr, alarmKey); + handleRecoveredAlert(currentTimeMilli, define, alarmKey); } } } catch (Exception e) { @@ -244,12 +244,12 @@ private void calculate(CollectRep.MetricsData metricsData) { } } - private void handleRecoveredAlert(long currentTimeMilli, AlertDefine define, String expr, String alarmKey) { + private void handleRecoveredAlert(long currentTimeMilli, AlertDefine define, String alarmKey) { Alert notResolvedAlert = notRecoveredAlertMap.remove(alarmKey); if (notResolvedAlert != null) { // Sending an alarm Restore Map tags = notResolvedAlert.getTags(); - String content = this.bundle.getString("alerter.alarm.recover") + " : " + expr; + String content = this.bundle.getString("alerter.alarm.recover") + " : " + notResolvedAlert.getContent(); Alert resumeAlert = Alert.builder() .tags(tags) .target(define.getApp() + "." + define.getMetric() + "." + define.getField())