diff --git a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/intercepter/EasyRetryInterceptor.java b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/intercepter/EasyRetryInterceptor.java
index a5ee41b3..f85ada72 100644
--- a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/intercepter/EasyRetryInterceptor.java
+++ b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/intercepter/EasyRetryInterceptor.java
@@ -19,6 +19,7 @@ import com.aizuda.easy.retry.common.core.enums.RetryResultStatusEnum;
import com.aizuda.easy.retry.common.core.log.LogUtils;
import com.aizuda.easy.retry.common.core.model.EasyRetryHeaders;
import com.aizuda.easy.retry.common.core.util.EnvironmentUtils;
+import com.aizuda.easy.retry.common.core.util.HostUtils;
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
import com.google.common.base.Defaults;
import lombok.extern.slf4j.Slf4j;
@@ -48,6 +49,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static String retryErrorMoreThresholdTextMessageFormatter =
"{}环境 重试组件异常 \n" +
+ "> IP:{} \n" +
"> 空间ID:{} \n" +
"> 名称:{} \n" +
"> 时间:{} \n" +
@@ -205,6 +207,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
AlarmContext context = AlarmContext.build()
.text(retryErrorMoreThresholdTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),
+ HostUtils.getIp(),
standardEnvironment.getProperty("easy-retry.namespace", StrUtil.EMPTY),
EasyRetryProperties.getGroup(),
LocalDateTime.now().format(formatter),
diff --git a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/ReportListener.java b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/ReportListener.java
index dacf29db..23cfad7a 100644
--- a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/ReportListener.java
+++ b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/ReportListener.java
@@ -15,6 +15,7 @@ import com.aizuda.easy.retry.common.core.enums.NotifySceneEnum;
import com.aizuda.easy.retry.common.core.log.LogUtils;
import com.aizuda.easy.retry.common.core.model.NettyResult;
import com.aizuda.easy.retry.common.core.util.EnvironmentUtils;
+import com.aizuda.easy.retry.common.core.util.HostUtils;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import com.aizuda.easy.retry.common.core.window.Listener;
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
@@ -41,7 +42,8 @@ public class ReportListener implements Listener {
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static String reportErrorTextMessageFormatter =
"{}环境 异步批量上报异常 \n" +
- "> 空间ID:{} n" +
+ "> IP:{} \n" +
+ "> 空间ID:{} \n" +
"> 名称:{} \n" +
"> 时间:{} \n" +
"> 异常:{} \n"
@@ -51,7 +53,6 @@ public class ReportListener implements Listener {
.client(NettyClient.class)
.callback(nettyResult -> LogUtils.info(log, "Data report successfully requestId:[{}]", nettyResult.getRequestId())).build();
-
@Override
public void handler(List list) {
RetryExecutor retryExecutor =
@@ -115,6 +116,7 @@ public class ReportListener implements Listener {
AlarmContext context = AlarmContext.build()
.text(reportErrorTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),
+ HostUtils.getIp(),
properties.getNamespace(),
EasyRetryProperties.getGroup(),
LocalDateTime.now().format(formatter),
diff --git a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/SyncReport.java b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/SyncReport.java
index 61c01df4..1164b4c2 100644
--- a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/SyncReport.java
+++ b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/report/SyncReport.java
@@ -13,6 +13,7 @@ import com.aizuda.easy.retry.common.core.enums.NotifySceneEnum;
import com.aizuda.easy.retry.common.core.log.LogUtils;
import com.aizuda.easy.retry.common.core.model.NettyResult;
import com.aizuda.easy.retry.common.core.util.EnvironmentUtils;
+import com.aizuda.easy.retry.common.core.util.HostUtils;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
import com.aizuda.easy.retry.server.model.dto.RetryTaskDTO;
@@ -41,6 +42,7 @@ public class SyncReport extends AbstractReport {
private static String reportErrorTextMessageFormatter =
"{}环境 同步上报异常 \n" +
+ "> IP:{} \n" +
"> 空间ID:{} \n" +
"> 名称:{} \n" +
"> 时间:{} \n" +
@@ -97,6 +99,7 @@ public class SyncReport extends AbstractReport {
AlarmContext context = AlarmContext.build()
.text(reportErrorTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),
+ HostUtils.getIp(),
easyRetryProperties.getNamespace(),
EasyRetryProperties.getGroup(),
LocalDateTime.now().format(formatter),
diff --git a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/strategy/AbstractRetryStrategies.java b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/strategy/AbstractRetryStrategies.java
index c2be4dff..87c1c7a3 100644
--- a/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/strategy/AbstractRetryStrategies.java
+++ b/easy-retry-client/easy-retry-client-core/src/main/java/com/aizuda/easy/retry/client/core/strategy/AbstractRetryStrategies.java
@@ -15,6 +15,7 @@ import com.aizuda.easy.retry.common.core.alarm.EasyRetryAlarmFactory;
import com.aizuda.easy.retry.common.core.enums.NotifySceneEnum;
import com.aizuda.easy.retry.common.core.log.LogUtils;
import com.aizuda.easy.retry.common.core.util.EnvironmentUtils;
+import com.aizuda.easy.retry.common.core.util.HostUtils;
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
import com.github.rholder.retry.Retryer;
import com.github.rholder.retry.StopStrategy;
@@ -41,6 +42,7 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static String retryErrorMoreThresholdTextMessageFormatter =
"{}环境 重试期间发生非预期异常 \n" +
+ "> IP:{} \n" +
"> 空间ID:{} \n" +
"> 名称:{} \n" +
"> 时间:{} \n" +
@@ -179,6 +181,7 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
AlarmContext context = AlarmContext.build()
.text(retryErrorMoreThresholdTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),
+ HostUtils.getIp(),
easyRetryProperties.getNamespace(),
EasyRetryProperties.getGroup(),
LocalDateTime.now().format(formatter),
diff --git a/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/enums/NotifySceneEnum.java b/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/enums/NotifySceneEnum.java
index 4b992f39..f31e21bd 100644
--- a/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/enums/NotifySceneEnum.java
+++ b/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/enums/NotifySceneEnum.java
@@ -7,6 +7,7 @@ import lombok.Getter;
*
* @author: www.byteblogs.com
* @date : 2021-11-24 18:18
+ * @since : 1.0.0
*/
@Getter
public enum NotifySceneEnum {
@@ -19,7 +20,7 @@ public enum NotifySceneEnum {
CLIENT_COMPONENT_ERROR(4,"客户端组件异常", NodeTypeEnum.CLIENT),
- RETRY_TASK_REACH_THRESHOLD(5, "任务重试失败数量超过阈值", NodeTypeEnum.SERVER),
+ RETRY_TASK_REACH_THRESHOLD(5, "任务重试次数超过阈值", NodeTypeEnum.SERVER),
RETRY_TASK_ENTER_DEAD_LETTER(6, "任务重试失败进入死信队列", NodeTypeEnum.SERVER);
diff --git a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/listener/RetryTaskFailMoreThresholdAlarmListener.java b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/listener/RetryTaskFailMoreThresholdAlarmListener.java
index 70e8cabc..09c48f68 100644
--- a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/listener/RetryTaskFailMoreThresholdAlarmListener.java
+++ b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/listener/RetryTaskFailMoreThresholdAlarmListener.java
@@ -49,7 +49,7 @@ public class RetryTaskFailMoreThresholdAlarmListener extends
*/
private LinkedBlockingQueue queue = new LinkedBlockingQueue<>(1000);
private static String retryTaskFailMoreThresholdMessagesFormatter =
- "{}环境 重试任务失败数量超过阈值 \n" +
+ "{}环境 任务重试次数超过{}个 \n" +
"> 空间ID:{} \n" +
"> 组名称:{} \n" +
"> 执行器名称:{} \n" +
@@ -83,6 +83,7 @@ public class RetryTaskFailMoreThresholdAlarmListener extends
// 预警
return AlarmContext.build().text(retryTaskFailMoreThresholdMessagesFormatter,
EnvironmentUtils.getActiveProfile(),
+ notifyConfig.getNotifyThreshold(),
retryAlarmInfo.getNamespaceId(),
retryAlarmInfo.getGroupName(),
retryAlarmInfo.getExecutorName(),
@@ -90,7 +91,7 @@ public class RetryTaskFailMoreThresholdAlarmListener extends
retryAlarmInfo.getRetryCount(),
retryAlarmInfo.getArgsStr(),
DateUtils.format(retryAlarmInfo.getCreateDt(), DateUtils.NORM_DATETIME_PATTERN))
- .title("组:[{}] 场景:[{}] 环境重试任务失败数量超过阈值", retryAlarmInfo.getGroupName(),
+ .title("组:[{}] 场景:[{}] 环境任务重试次数超过阈值", retryAlarmInfo.getGroupName(),
retryAlarmInfo.getSceneName())
.notifyAttribute(notifyConfig.getNotifyAttribute());
}
diff --git a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryErrorMoreThresholdAlarmSchedule.java b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryErrorMoreThresholdAlarmSchedule.java
index ade7f401..296523fd 100644
--- a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryErrorMoreThresholdAlarmSchedule.java
+++ b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryErrorMoreThresholdAlarmSchedule.java
@@ -47,7 +47,8 @@ import java.util.List;
@Slf4j
public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule implements Lifecycle {
private static String retryErrorMoreThresholdTextMessageFormatter =
- "{}环境 重试失败数据监控 \n" +
+ "{}环境 场景重试失败数量超过{}个 \n" +
+ "> 空间ID:{} \n" +
"> 组名称:{} \n" +
"> 场景名称:{} \n" +
"> 时间窗口:{} ~ {} \n" +
@@ -90,11 +91,13 @@ public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule imple
between(RetryDeadLetter::getCreateDt, now.minusMinutes(30), now)
.eq(RetryDeadLetter::getGroupName, notifyConfigPartitionTask.getGroupName())
.eq(RetryDeadLetter::getSceneName, notifyConfigPartitionTask.getSceneName()));
- if (count > notifyConfigPartitionTask.getNotifyThreshold()) {
+ if (count >= notifyConfigPartitionTask.getNotifyThreshold()) {
// 预警
AlarmContext context = AlarmContext.build()
.text(retryErrorMoreThresholdTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),
+ count,
+ notifyConfigPartitionTask.getNamespaceId(),
notifyConfigPartitionTask.getGroupName(),
notifyConfigPartitionTask.getSceneName(),
DateUtils.format(now.minusMinutes(30),
diff --git a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryTaskMoreThresholdAlarmSchedule.java b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryTaskMoreThresholdAlarmSchedule.java
index 6945733a..942bb6f0 100644
--- a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryTaskMoreThresholdAlarmSchedule.java
+++ b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetryTaskMoreThresholdAlarmSchedule.java
@@ -44,7 +44,8 @@ import java.util.List;
@RequiredArgsConstructor
public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implements Lifecycle {
private static String retryTaskMoreThresholdTextMessageFormatter =
- "{}环境 重试数据监控 \n" +
+ "{}环境 场景重试数量超过{}个 \n" +
+ "> 空间ID:{} \n" +
"> 组名称:{} \n" +
"> 场景名称:{} \n" +
"> 告警时间:{} \n" +
@@ -83,11 +84,13 @@ public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implem
.eq(RetryTask::getGroupName, partitionTask.getGroupName())
.eq(RetryTask::getSceneName, partitionTask.getSceneName())
.eq(RetryTask::getRetryStatus, RetryStatusEnum.RUNNING.getStatus()));
- if (count > partitionTask.getNotifyThreshold()) {
+ if (count >= partitionTask.getNotifyThreshold()) {
// 预警
AlarmContext context = AlarmContext.build()
.text(retryTaskMoreThresholdTextMessageFormatter,
EnvironmentUtils.getActiveProfile(),
+ count,
+ partitionTask.getNamespaceId(),
partitionTask.getGroupName(),
partitionTask.getSceneName(),
DateUtils.toNowFormat(DateUtils.NORM_DATETIME_PATTERN),