refactor:2.5.0
1. 优化告警内容
This commit is contained in:
		
							parent
							
								
									8e9eafb4c8
								
							
						
					
					
						commit
						dfc1243d58
					
				@ -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.log.LogUtils;
 | 
				
			||||||
import com.aizuda.easy.retry.common.core.model.EasyRetryHeaders;
 | 
					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.EnvironmentUtils;
 | 
				
			||||||
 | 
					import com.aizuda.easy.retry.common.core.util.HostUtils;
 | 
				
			||||||
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
					import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
				
			||||||
import com.google.common.base.Defaults;
 | 
					import com.google.common.base.Defaults;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					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 final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
				
			||||||
    private static String retryErrorMoreThresholdTextMessageFormatter =
 | 
					    private static String retryErrorMoreThresholdTextMessageFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font>  \n" +
 | 
				
			||||||
 | 
					                    "> IP:{}  \n" +
 | 
				
			||||||
                    "> 空间ID:{}  \n" +
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 名称:{}  \n" +
 | 
					                    "> 名称:{}  \n" +
 | 
				
			||||||
                    "> 时间:{}  \n" +
 | 
					                    "> 时间:{}  \n" +
 | 
				
			||||||
@ -205,6 +207,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
 | 
				
			|||||||
                AlarmContext context = AlarmContext.build()
 | 
					                AlarmContext context = AlarmContext.build()
 | 
				
			||||||
                        .text(retryErrorMoreThresholdTextMessageFormatter,
 | 
					                        .text(retryErrorMoreThresholdTextMessageFormatter,
 | 
				
			||||||
                                EnvironmentUtils.getActiveProfile(),
 | 
					                                EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                                HostUtils.getIp(),
 | 
				
			||||||
                                standardEnvironment.getProperty("easy-retry.namespace", StrUtil.EMPTY),
 | 
					                                standardEnvironment.getProperty("easy-retry.namespace", StrUtil.EMPTY),
 | 
				
			||||||
                                EasyRetryProperties.getGroup(),
 | 
					                                EasyRetryProperties.getGroup(),
 | 
				
			||||||
                                LocalDateTime.now().format(formatter),
 | 
					                                LocalDateTime.now().format(formatter),
 | 
				
			||||||
 | 
				
			|||||||
@ -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.log.LogUtils;
 | 
				
			||||||
import com.aizuda.easy.retry.common.core.model.NettyResult;
 | 
					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.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.util.JsonUtil;
 | 
				
			||||||
import com.aizuda.easy.retry.common.core.window.Listener;
 | 
					import com.aizuda.easy.retry.common.core.window.Listener;
 | 
				
			||||||
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
					import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
				
			||||||
@ -41,7 +42,8 @@ public class ReportListener implements Listener<RetryTaskDTO> {
 | 
				
			|||||||
    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
					    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
				
			||||||
    private static String reportErrorTextMessageFormatter =
 | 
					    private static String reportErrorTextMessageFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 异步批量上报异常</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 异步批量上报异常</font>  \n" +
 | 
				
			||||||
                    "> 空间ID:{}  n" +
 | 
					                    "> IP:{}  \n" +
 | 
				
			||||||
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 名称:{}  \n" +
 | 
					                    "> 名称:{}  \n" +
 | 
				
			||||||
                    "> 时间:{}  \n" +
 | 
					                    "> 时间:{}  \n" +
 | 
				
			||||||
                    "> 异常:{}  \n"
 | 
					                    "> 异常:{}  \n"
 | 
				
			||||||
@ -51,7 +53,6 @@ public class ReportListener implements Listener<RetryTaskDTO> {
 | 
				
			|||||||
        .client(NettyClient.class)
 | 
					        .client(NettyClient.class)
 | 
				
			||||||
        .callback(nettyResult -> LogUtils.info(log, "Data report successfully requestId:[{}]", nettyResult.getRequestId())).build();
 | 
					        .callback(nettyResult -> LogUtils.info(log, "Data report successfully requestId:[{}]", nettyResult.getRequestId())).build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void handler(List<RetryTaskDTO> list) {
 | 
					    public void handler(List<RetryTaskDTO> list) {
 | 
				
			||||||
        RetryExecutor<WaitStrategy, StopStrategy> retryExecutor =
 | 
					        RetryExecutor<WaitStrategy, StopStrategy> retryExecutor =
 | 
				
			||||||
@ -115,6 +116,7 @@ public class ReportListener implements Listener<RetryTaskDTO> {
 | 
				
			|||||||
            AlarmContext context = AlarmContext.build()
 | 
					            AlarmContext context = AlarmContext.build()
 | 
				
			||||||
                    .text(reportErrorTextMessageFormatter,
 | 
					                    .text(reportErrorTextMessageFormatter,
 | 
				
			||||||
                            EnvironmentUtils.getActiveProfile(),
 | 
					                            EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                            HostUtils.getIp(),
 | 
				
			||||||
                            properties.getNamespace(),
 | 
					                            properties.getNamespace(),
 | 
				
			||||||
                            EasyRetryProperties.getGroup(),
 | 
					                            EasyRetryProperties.getGroup(),
 | 
				
			||||||
                            LocalDateTime.now().format(formatter),
 | 
					                            LocalDateTime.now().format(formatter),
 | 
				
			||||||
 | 
				
			|||||||
@ -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.log.LogUtils;
 | 
				
			||||||
import com.aizuda.easy.retry.common.core.model.NettyResult;
 | 
					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.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.util.JsonUtil;
 | 
				
			||||||
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
					import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
				
			||||||
import com.aizuda.easy.retry.server.model.dto.RetryTaskDTO;
 | 
					import com.aizuda.easy.retry.server.model.dto.RetryTaskDTO;
 | 
				
			||||||
@ -41,6 +42,7 @@ public class SyncReport extends AbstractReport {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private static String reportErrorTextMessageFormatter =
 | 
					    private static String reportErrorTextMessageFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 同步上报异常</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 同步上报异常</font>  \n" +
 | 
				
			||||||
 | 
					                    "> IP:{}  \n" +
 | 
				
			||||||
                    "> 空间ID:{}  \n" +
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 名称:{}  \n" +
 | 
					                    "> 名称:{}  \n" +
 | 
				
			||||||
                    "> 时间:{}  \n" +
 | 
					                    "> 时间:{}  \n" +
 | 
				
			||||||
@ -97,6 +99,7 @@ public class SyncReport extends AbstractReport {
 | 
				
			|||||||
            AlarmContext context = AlarmContext.build()
 | 
					            AlarmContext context = AlarmContext.build()
 | 
				
			||||||
                    .text(reportErrorTextMessageFormatter,
 | 
					                    .text(reportErrorTextMessageFormatter,
 | 
				
			||||||
                            EnvironmentUtils.getActiveProfile(),
 | 
					                            EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                            HostUtils.getIp(),
 | 
				
			||||||
                            easyRetryProperties.getNamespace(),
 | 
					                            easyRetryProperties.getNamespace(),
 | 
				
			||||||
                            EasyRetryProperties.getGroup(),
 | 
					                            EasyRetryProperties.getGroup(),
 | 
				
			||||||
                            LocalDateTime.now().format(formatter),
 | 
					                            LocalDateTime.now().format(formatter),
 | 
				
			||||||
 | 
				
			|||||||
@ -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.enums.NotifySceneEnum;
 | 
				
			||||||
import com.aizuda.easy.retry.common.core.log.LogUtils;
 | 
					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.EnvironmentUtils;
 | 
				
			||||||
 | 
					import com.aizuda.easy.retry.common.core.util.HostUtils;
 | 
				
			||||||
import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
					import com.aizuda.easy.retry.server.model.dto.ConfigDTO;
 | 
				
			||||||
import com.github.rholder.retry.Retryer;
 | 
					import com.github.rholder.retry.Retryer;
 | 
				
			||||||
import com.github.rholder.retry.StopStrategy;
 | 
					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 final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
				
			||||||
    private static String retryErrorMoreThresholdTextMessageFormatter =
 | 
					    private static String retryErrorMoreThresholdTextMessageFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试期间发生非预期异常</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试期间发生非预期异常</font>  \n" +
 | 
				
			||||||
 | 
					                    "> IP:{}  \n" +
 | 
				
			||||||
                    "> 空间ID:{}  \n" +
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 名称:{}  \n" +
 | 
					                    "> 名称:{}  \n" +
 | 
				
			||||||
                    "> 时间:{}  \n" +
 | 
					                    "> 时间:{}  \n" +
 | 
				
			||||||
@ -179,6 +181,7 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
 | 
				
			|||||||
                AlarmContext context = AlarmContext.build()
 | 
					                AlarmContext context = AlarmContext.build()
 | 
				
			||||||
                        .text(retryErrorMoreThresholdTextMessageFormatter,
 | 
					                        .text(retryErrorMoreThresholdTextMessageFormatter,
 | 
				
			||||||
                                EnvironmentUtils.getActiveProfile(),
 | 
					                                EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                                HostUtils.getIp(),
 | 
				
			||||||
                                easyRetryProperties.getNamespace(),
 | 
					                                easyRetryProperties.getNamespace(),
 | 
				
			||||||
                                EasyRetryProperties.getGroup(),
 | 
					                                EasyRetryProperties.getGroup(),
 | 
				
			||||||
                                LocalDateTime.now().format(formatter),
 | 
					                                LocalDateTime.now().format(formatter),
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,7 @@ import lombok.Getter;
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author: www.byteblogs.com
 | 
					 * @author: www.byteblogs.com
 | 
				
			||||||
 * @date : 2021-11-24 18:18
 | 
					 * @date : 2021-11-24 18:18
 | 
				
			||||||
 | 
					 * @since : 1.0.0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Getter
 | 
					@Getter
 | 
				
			||||||
public enum NotifySceneEnum {
 | 
					public enum NotifySceneEnum {
 | 
				
			||||||
@ -19,7 +20,7 @@ public enum NotifySceneEnum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    CLIENT_COMPONENT_ERROR(4,"客户端组件异常", NodeTypeEnum.CLIENT),
 | 
					    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);
 | 
					    RETRY_TASK_ENTER_DEAD_LETTER(6, "任务重试失败进入死信队列", NodeTypeEnum.SERVER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -49,7 +49,7 @@ public class RetryTaskFailMoreThresholdAlarmListener extends
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private LinkedBlockingQueue<RetryTask> queue = new LinkedBlockingQueue<>(1000);
 | 
					    private LinkedBlockingQueue<RetryTask> queue = new LinkedBlockingQueue<>(1000);
 | 
				
			||||||
    private static String retryTaskFailMoreThresholdMessagesFormatter =
 | 
					    private static String retryTaskFailMoreThresholdMessagesFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试任务失败数量超过阈值</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 任务重试次数超过{}个</font>  \n" +
 | 
				
			||||||
                    "> 空间ID:{}  \n" +
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 组名称:{}  \n" +
 | 
					                    "> 组名称:{}  \n" +
 | 
				
			||||||
                    "> 执行器名称:{}  \n" +
 | 
					                    "> 执行器名称:{}  \n" +
 | 
				
			||||||
@ -83,6 +83,7 @@ public class RetryTaskFailMoreThresholdAlarmListener extends
 | 
				
			|||||||
        // 预警
 | 
					        // 预警
 | 
				
			||||||
        return AlarmContext.build().text(retryTaskFailMoreThresholdMessagesFormatter,
 | 
					        return AlarmContext.build().text(retryTaskFailMoreThresholdMessagesFormatter,
 | 
				
			||||||
                        EnvironmentUtils.getActiveProfile(),
 | 
					                        EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                        notifyConfig.getNotifyThreshold(),
 | 
				
			||||||
                        retryAlarmInfo.getNamespaceId(),
 | 
					                        retryAlarmInfo.getNamespaceId(),
 | 
				
			||||||
                        retryAlarmInfo.getGroupName(),
 | 
					                        retryAlarmInfo.getGroupName(),
 | 
				
			||||||
                        retryAlarmInfo.getExecutorName(),
 | 
					                        retryAlarmInfo.getExecutorName(),
 | 
				
			||||||
@ -90,7 +91,7 @@ public class RetryTaskFailMoreThresholdAlarmListener extends
 | 
				
			|||||||
                        retryAlarmInfo.getRetryCount(),
 | 
					                        retryAlarmInfo.getRetryCount(),
 | 
				
			||||||
                        retryAlarmInfo.getArgsStr(),
 | 
					                        retryAlarmInfo.getArgsStr(),
 | 
				
			||||||
                        DateUtils.format(retryAlarmInfo.getCreateDt(), DateUtils.NORM_DATETIME_PATTERN))
 | 
					                        DateUtils.format(retryAlarmInfo.getCreateDt(), DateUtils.NORM_DATETIME_PATTERN))
 | 
				
			||||||
                .title("组:[{}] 场景:[{}] 环境重试任务失败数量超过阈值", retryAlarmInfo.getGroupName(),
 | 
					                .title("组:[{}] 场景:[{}] 环境任务重试次数超过阈值", retryAlarmInfo.getGroupName(),
 | 
				
			||||||
                        retryAlarmInfo.getSceneName())
 | 
					                        retryAlarmInfo.getSceneName())
 | 
				
			||||||
                .notifyAttribute(notifyConfig.getNotifyAttribute());
 | 
					                .notifyAttribute(notifyConfig.getNotifyAttribute());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,8 @@ import java.util.List;
 | 
				
			|||||||
@Slf4j
 | 
					@Slf4j
 | 
				
			||||||
public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule implements Lifecycle {
 | 
					public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule implements Lifecycle {
 | 
				
			||||||
    private static String retryErrorMoreThresholdTextMessageFormatter =
 | 
					    private static String retryErrorMoreThresholdTextMessageFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试失败数据监控</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 场景重试失败数量超过{}个</font>  \n" +
 | 
				
			||||||
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 组名称:{}  \n" +
 | 
					                    "> 组名称:{}  \n" +
 | 
				
			||||||
                    "> 场景名称:{}  \n" +
 | 
					                    "> 场景名称:{}  \n" +
 | 
				
			||||||
                    "> 时间窗口:{} ~ {}  \n" +
 | 
					                    "> 时间窗口:{} ~ {}  \n" +
 | 
				
			||||||
@ -90,11 +91,13 @@ public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule imple
 | 
				
			|||||||
                        between(RetryDeadLetter::getCreateDt, now.minusMinutes(30), now)
 | 
					                        between(RetryDeadLetter::getCreateDt, now.minusMinutes(30), now)
 | 
				
			||||||
                        .eq(RetryDeadLetter::getGroupName, notifyConfigPartitionTask.getGroupName())
 | 
					                        .eq(RetryDeadLetter::getGroupName, notifyConfigPartitionTask.getGroupName())
 | 
				
			||||||
                        .eq(RetryDeadLetter::getSceneName, notifyConfigPartitionTask.getSceneName()));
 | 
					                        .eq(RetryDeadLetter::getSceneName, notifyConfigPartitionTask.getSceneName()));
 | 
				
			||||||
        if (count > notifyConfigPartitionTask.getNotifyThreshold()) {
 | 
					        if (count >= notifyConfigPartitionTask.getNotifyThreshold()) {
 | 
				
			||||||
            // 预警
 | 
					            // 预警
 | 
				
			||||||
            AlarmContext context = AlarmContext.build()
 | 
					            AlarmContext context = AlarmContext.build()
 | 
				
			||||||
                    .text(retryErrorMoreThresholdTextMessageFormatter,
 | 
					                    .text(retryErrorMoreThresholdTextMessageFormatter,
 | 
				
			||||||
                            EnvironmentUtils.getActiveProfile(),
 | 
					                            EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                            count,
 | 
				
			||||||
 | 
					                            notifyConfigPartitionTask.getNamespaceId(),
 | 
				
			||||||
                            notifyConfigPartitionTask.getGroupName(),
 | 
					                            notifyConfigPartitionTask.getGroupName(),
 | 
				
			||||||
                            notifyConfigPartitionTask.getSceneName(),
 | 
					                            notifyConfigPartitionTask.getSceneName(),
 | 
				
			||||||
                            DateUtils.format(now.minusMinutes(30),
 | 
					                            DateUtils.format(now.minusMinutes(30),
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,8 @@ import java.util.List;
 | 
				
			|||||||
@RequiredArgsConstructor
 | 
					@RequiredArgsConstructor
 | 
				
			||||||
public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implements Lifecycle {
 | 
					public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implements Lifecycle {
 | 
				
			||||||
    private static String retryTaskMoreThresholdTextMessageFormatter =
 | 
					    private static String retryTaskMoreThresholdTextMessageFormatter =
 | 
				
			||||||
            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试数据监控</font>  \n" +
 | 
					            "<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 场景重试数量超过{}个</font>  \n" +
 | 
				
			||||||
 | 
					                    "> 空间ID:{}  \n" +
 | 
				
			||||||
                    "> 组名称:{}  \n" +
 | 
					                    "> 组名称:{}  \n" +
 | 
				
			||||||
                    "> 场景名称:{}  \n" +
 | 
					                    "> 场景名称:{}  \n" +
 | 
				
			||||||
                    "> 告警时间:{}  \n" +
 | 
					                    "> 告警时间:{}  \n" +
 | 
				
			||||||
@ -83,11 +84,13 @@ public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implem
 | 
				
			|||||||
                                .eq(RetryTask::getGroupName, partitionTask.getGroupName())
 | 
					                                .eq(RetryTask::getGroupName, partitionTask.getGroupName())
 | 
				
			||||||
                                .eq(RetryTask::getSceneName, partitionTask.getSceneName())
 | 
					                                .eq(RetryTask::getSceneName, partitionTask.getSceneName())
 | 
				
			||||||
                                .eq(RetryTask::getRetryStatus, RetryStatusEnum.RUNNING.getStatus()));
 | 
					                                .eq(RetryTask::getRetryStatus, RetryStatusEnum.RUNNING.getStatus()));
 | 
				
			||||||
        if (count > partitionTask.getNotifyThreshold()) {
 | 
					        if (count >= partitionTask.getNotifyThreshold()) {
 | 
				
			||||||
            // 预警
 | 
					            // 预警
 | 
				
			||||||
            AlarmContext context = AlarmContext.build()
 | 
					            AlarmContext context = AlarmContext.build()
 | 
				
			||||||
                    .text(retryTaskMoreThresholdTextMessageFormatter,
 | 
					                    .text(retryTaskMoreThresholdTextMessageFormatter,
 | 
				
			||||||
                            EnvironmentUtils.getActiveProfile(),
 | 
					                            EnvironmentUtils.getActiveProfile(),
 | 
				
			||||||
 | 
					                            count,
 | 
				
			||||||
 | 
					                            partitionTask.getNamespaceId(),
 | 
				
			||||||
                            partitionTask.getGroupName(),
 | 
					                            partitionTask.getGroupName(),
 | 
				
			||||||
                            partitionTask.getSceneName(),
 | 
					                            partitionTask.getSceneName(),
 | 
				
			||||||
                            DateUtils.toNowFormat(DateUtils.NORM_DATETIME_PATTERN),
 | 
					                            DateUtils.toNowFormat(DateUtils.NORM_DATETIME_PATTERN),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user