fix:2.5.0
1. 修复钉钉发送失败问题 2. 客户端异常信息添加空间ID 3. 修复告警阈值没有匹配最大重试次数问题
This commit is contained in:
parent
9d553ab2c1
commit
8e9eafb4c8
@ -47,16 +47,17 @@ 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> \r\n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
||||||
"> 名称:{} \r\n" +
|
"> 空间ID:{} \n" +
|
||||||
"> 时间:{} \r\n" +
|
"> 名称:{} \n" +
|
||||||
|
"> 时间:{} \n" +
|
||||||
"> 异常:{} \n";
|
"> 异常:{} \n";
|
||||||
|
|
||||||
private final StandardEnvironment standardEnvironment;
|
private final StandardEnvironment standardEnvironment;
|
||||||
private final RetryStrategy retryStrategy;
|
private final RetryStrategy retryStrategy;
|
||||||
|
|
||||||
public EasyRetryInterceptor(StandardEnvironment standardEnvironment,
|
public EasyRetryInterceptor(StandardEnvironment standardEnvironment,
|
||||||
RetryStrategy localRetryStrategies) {
|
RetryStrategy localRetryStrategies) {
|
||||||
this.standardEnvironment = standardEnvironment;
|
this.standardEnvironment = standardEnvironment;
|
||||||
this.retryStrategy = localRetryStrategies;
|
this.retryStrategy = localRetryStrategies;
|
||||||
}
|
}
|
||||||
@ -84,10 +85,10 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
LogUtils.debug(log, "Start retrying. traceId:[{}] scene:[{}] executorClassName:[{}]", traceId,
|
LogUtils.debug(log, "Start retrying. traceId:[{}] scene:[{}] executorClassName:[{}]", traceId,
|
||||||
retryable.scene(), executorClassName);
|
retryable.scene(), executorClassName);
|
||||||
// 入口则开始处理重试
|
// 入口则开始处理重试
|
||||||
retryerResultContext = doHandlerRetry(invocation, traceId, retryable, executorClassName, methodEntrance,
|
retryerResultContext = doHandlerRetry(invocation, traceId, retryable, executorClassName, methodEntrance,
|
||||||
throwable);
|
throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogUtils.debug(log, "Method return value is [{}]. traceId:[{}]", result, traceId, throwable);
|
LogUtils.debug(log, "Method return value is [{}]. traceId:[{}]", result, traceId, throwable);
|
||||||
@ -96,8 +97,8 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
if (Objects.nonNull(retryerResultContext)) {
|
if (Objects.nonNull(retryerResultContext)) {
|
||||||
// 重试成功直接返回结果 若注解配置了isThrowException=false 则不抛出异常
|
// 重试成功直接返回结果 若注解配置了isThrowException=false 则不抛出异常
|
||||||
if (retryerResultContext.getRetryResultStatusEnum().getStatus()
|
if (retryerResultContext.getRetryResultStatusEnum().getStatus()
|
||||||
.equals(RetryResultStatusEnum.SUCCESS.getStatus())
|
.equals(RetryResultStatusEnum.SUCCESS.getStatus())
|
||||||
|| !retryable.isThrowException()) {
|
|| !retryable.isThrowException()) {
|
||||||
|
|
||||||
// 若返回值是NULL且是基本类型则返回默认值
|
// 若返回值是NULL且是基本类型则返回默认值
|
||||||
Method method = invocation.getMethod();
|
Method method = invocation.getMethod();
|
||||||
@ -119,32 +120,32 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
|
|
||||||
|
|
||||||
private RetryerResultContext doHandlerRetry(MethodInvocation invocation, String traceId, Retryable retryable,
|
private RetryerResultContext doHandlerRetry(MethodInvocation invocation, String traceId, Retryable retryable,
|
||||||
String executorClassName, String methodEntrance, Throwable throwable) {
|
String executorClassName, String methodEntrance, Throwable throwable) {
|
||||||
|
|
||||||
if (!RetrySiteSnapshot.isMethodEntrance(methodEntrance)
|
if (!RetrySiteSnapshot.isMethodEntrance(methodEntrance)
|
||||||
|| RetrySiteSnapshot.isRunning()
|
|| RetrySiteSnapshot.isRunning()
|
||||||
|| Objects.isNull(throwable)
|
|| Objects.isNull(throwable)
|
||||||
// 重试流量不开启重试
|
// 重试流量不开启重试
|
||||||
|| RetrySiteSnapshot.isRetryFlow()
|
|| RetrySiteSnapshot.isRetryFlow()
|
||||||
// 下游响应不重试码,不开启重试
|
// 下游响应不重试码,不开启重试
|
||||||
|| RetrySiteSnapshot.isRetryForStatusCode()
|
|| RetrySiteSnapshot.isRetryForStatusCode()
|
||||||
// 匹配异常信息
|
// 匹配异常信息
|
||||||
|| !validate(throwable, RetryerInfoCache.get(retryable.scene(), executorClassName))
|
|| !validate(throwable, RetryerInfoCache.get(retryable.scene(), executorClassName))
|
||||||
) {
|
) {
|
||||||
if (!RetrySiteSnapshot.isMethodEntrance(methodEntrance)) {
|
if (!RetrySiteSnapshot.isMethodEntrance(methodEntrance)) {
|
||||||
LogUtils.debug(log, "Non-method entry does not enable local retries. traceId:[{}] [{}]", traceId,
|
LogUtils.debug(log, "Non-method entry does not enable local retries. traceId:[{}] [{}]", traceId,
|
||||||
RetrySiteSnapshot.getMethodEntrance());
|
RetrySiteSnapshot.getMethodEntrance());
|
||||||
} else if (RetrySiteSnapshot.isRunning()) {
|
} else if (RetrySiteSnapshot.isRunning()) {
|
||||||
LogUtils.debug(log, "Existing running retry tasks do not enable local retries. traceId:[{}] [{}]",
|
LogUtils.debug(log, "Existing running retry tasks do not enable local retries. traceId:[{}] [{}]",
|
||||||
traceId, EnumStage.valueOfStage(RetrySiteSnapshot.getStage()));
|
traceId, EnumStage.valueOfStage(RetrySiteSnapshot.getStage()));
|
||||||
} else if (Objects.isNull(throwable)) {
|
} else if (Objects.isNull(throwable)) {
|
||||||
LogUtils.debug(log, "No exception, no local retries. traceId:[{}]", traceId);
|
LogUtils.debug(log, "No exception, no local retries. traceId:[{}]", traceId);
|
||||||
} else if (RetrySiteSnapshot.isRetryFlow()) {
|
} else if (RetrySiteSnapshot.isRetryFlow()) {
|
||||||
LogUtils.debug(log, "Retry traffic does not enable local retries. traceId:[{}] [{}]", traceId,
|
LogUtils.debug(log, "Retry traffic does not enable local retries. traceId:[{}] [{}]", traceId,
|
||||||
RetrySiteSnapshot.getRetryHeader());
|
RetrySiteSnapshot.getRetryHeader());
|
||||||
} else if (RetrySiteSnapshot.isRetryForStatusCode()) {
|
} else if (RetrySiteSnapshot.isRetryForStatusCode()) {
|
||||||
LogUtils.debug(log, "Existing exception retry codes do not enable local retries. traceId:[{}]",
|
LogUtils.debug(log, "Existing exception retry codes do not enable local retries. traceId:[{}]",
|
||||||
traceId);
|
traceId);
|
||||||
} else if (!validate(throwable, RetryerInfoCache.get(retryable.scene(), executorClassName))) {
|
} else if (!validate(throwable, RetryerInfoCache.get(retryable.scene(), executorClassName))) {
|
||||||
LogUtils.debug(log, "Exception mismatch. traceId:[{}]", traceId);
|
LogUtils.debug(log, "Exception mismatch. traceId:[{}]", traceId);
|
||||||
} else {
|
} else {
|
||||||
@ -157,7 +158,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
}
|
}
|
||||||
|
|
||||||
private RetryerResultContext openRetry(MethodInvocation point, String traceId, Retryable retryable,
|
private RetryerResultContext openRetry(MethodInvocation point, String traceId, Retryable retryable,
|
||||||
String executorClassName, Throwable throwable) {
|
String executorClassName, Throwable throwable) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
initHeaders(retryable);
|
initHeaders(retryable);
|
||||||
|
|
||||||
RetryerResultContext context = retryStrategy.openRetry(retryable.scene(), executorClassName,
|
RetryerResultContext context = retryStrategy.openRetry(retryable.scene(), executorClassName,
|
||||||
point.getArguments());
|
point.getArguments());
|
||||||
if (RetryResultStatusEnum.SUCCESS.getStatus().equals(context.getRetryResultStatusEnum().getStatus())) {
|
if (RetryResultStatusEnum.SUCCESS.getStatus().equals(context.getRetryResultStatusEnum().getStatus())) {
|
||||||
LogUtils.debug(log, "local retry successful. traceId:[{}] result:[{}]", traceId, context.getResult());
|
LogUtils.debug(log, "local retry successful. traceId:[{}] result:[{}]", traceId, context.getResult());
|
||||||
} else {
|
} else {
|
||||||
@ -204,6 +205,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
AlarmContext context = AlarmContext.build()
|
AlarmContext context = AlarmContext.build()
|
||||||
.text(retryErrorMoreThresholdTextMessageFormatter,
|
.text(retryErrorMoreThresholdTextMessageFormatter,
|
||||||
EnvironmentUtils.getActiveProfile(),
|
EnvironmentUtils.getActiveProfile(),
|
||||||
|
standardEnvironment.getProperty("easy-retry.namespace", StrUtil.EMPTY),
|
||||||
EasyRetryProperties.getGroup(),
|
EasyRetryProperties.getGroup(),
|
||||||
LocalDateTime.now().format(formatter),
|
LocalDateTime.now().format(formatter),
|
||||||
e.getMessage())
|
e.getMessage())
|
||||||
@ -247,7 +249,7 @@ public class EasyRetryInterceptor implements MethodInterceptor, AfterAdvice, Ser
|
|||||||
@Override
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
String order = standardEnvironment
|
String order = standardEnvironment
|
||||||
.getProperty("easy-retry.aop.order", String.valueOf(Ordered.HIGHEST_PRECEDENCE));
|
.getProperty("easy-retry.aop.order", String.valueOf(Ordered.HIGHEST_PRECEDENCE));
|
||||||
return Integer.parseInt(order);
|
return Integer.parseInt(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +40,10 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class ReportListener implements Listener<RetryTaskDTO> {
|
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> \r\n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 异步批量上报异常</font> \n" +
|
||||||
"> 名称:{} \r\n" +
|
"> 空间ID:{} n" +
|
||||||
"> 时间:{} \r\n" +
|
"> 名称:{} \n" +
|
||||||
|
"> 时间:{} \n" +
|
||||||
"> 异常:{} \n"
|
"> 异常:{} \n"
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -106,20 +107,24 @@ public class ReportListener implements Listener<RetryTaskDTO> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
ConfigDTO.Notify notifyAttribute = GroupVersionCache.getNotifyAttribute(NotifySceneEnum.CLIENT_REPORT_ERROR.getNotifyScene());
|
ConfigDTO.Notify notifyAttribute = GroupVersionCache.getNotifyAttribute(NotifySceneEnum.CLIENT_REPORT_ERROR.getNotifyScene());
|
||||||
if (Objects.nonNull(notifyAttribute)) {
|
if (Objects.isNull(notifyAttribute)) {
|
||||||
AlarmContext context = AlarmContext.build()
|
return;
|
||||||
.text(reportErrorTextMessageFormatter,
|
|
||||||
EnvironmentUtils.getActiveProfile(),
|
|
||||||
EasyRetryProperties.getGroup(),
|
|
||||||
LocalDateTime.now().format(formatter),
|
|
||||||
e.getMessage())
|
|
||||||
.title("上报异常:[{}]", EasyRetryProperties.getGroup())
|
|
||||||
.notifyAttribute(notifyAttribute.getNotifyAttribute());
|
|
||||||
|
|
||||||
EasyRetryAlarmFactory easyRetryAlarmFactory = SpringContext.getBeanByType(EasyRetryAlarmFactory.class);
|
|
||||||
Alarm<AlarmContext> alarmType = easyRetryAlarmFactory.getAlarmType(notifyAttribute.getNotifyType());
|
|
||||||
alarmType.asyncSendMessage(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EasyRetryProperties properties = SpringContext.CONTEXT.getBean(EasyRetryProperties.class);
|
||||||
|
AlarmContext context = AlarmContext.build()
|
||||||
|
.text(reportErrorTextMessageFormatter,
|
||||||
|
EnvironmentUtils.getActiveProfile(),
|
||||||
|
properties.getNamespace(),
|
||||||
|
EasyRetryProperties.getGroup(),
|
||||||
|
LocalDateTime.now().format(formatter),
|
||||||
|
e.getMessage())
|
||||||
|
.title("上报异常:[{}]", EasyRetryProperties.getGroup())
|
||||||
|
.notifyAttribute(notifyAttribute.getNotifyAttribute());
|
||||||
|
|
||||||
|
EasyRetryAlarmFactory easyRetryAlarmFactory = SpringContext.getBeanByType(EasyRetryAlarmFactory.class);
|
||||||
|
Alarm<AlarmContext> alarmType = easyRetryAlarmFactory.getAlarmType(notifyAttribute.getNotifyType());
|
||||||
|
alarmType.asyncSendMessage(context);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
LogUtils.error(log, "客户端发送组件异常告警失败", e1);
|
LogUtils.error(log, "客户端发送组件异常告警失败", e1);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,29 @@
|
|||||||
package com.aizuda.easy.retry.client.core.report;
|
package com.aizuda.easy.retry.client.core.report;
|
||||||
|
|
||||||
|
import com.aizuda.easy.retry.client.common.cache.GroupVersionCache;
|
||||||
|
import com.aizuda.easy.retry.client.common.config.EasyRetryProperties;
|
||||||
import com.aizuda.easy.retry.client.common.proxy.RequestBuilder;
|
import com.aizuda.easy.retry.client.common.proxy.RequestBuilder;
|
||||||
import com.aizuda.easy.retry.client.core.client.NettyClient;
|
import com.aizuda.easy.retry.client.core.client.NettyClient;
|
||||||
import com.aizuda.easy.retry.client.core.retryer.RetryerInfo;
|
import com.aizuda.easy.retry.client.core.retryer.RetryerInfo;
|
||||||
|
import com.aizuda.easy.retry.common.core.alarm.Alarm;
|
||||||
|
import com.aizuda.easy.retry.common.core.alarm.AlarmContext;
|
||||||
|
import com.aizuda.easy.retry.common.core.alarm.EasyRetryAlarmFactory;
|
||||||
|
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||||
|
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.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.RetryTaskDTO;
|
import com.aizuda.easy.retry.server.model.dto.RetryTaskDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,6 +37,19 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SyncReport extends AbstractReport {
|
public class SyncReport extends AbstractReport {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
private static String reportErrorTextMessageFormatter =
|
||||||
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 同步上报异常</font> \n" +
|
||||||
|
"> 空间ID:{} \n" +
|
||||||
|
"> 名称:{} \n" +
|
||||||
|
"> 时间:{} \n" +
|
||||||
|
"> 异常:{} \n"
|
||||||
|
;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EasyRetryProperties easyRetryProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(boolean async) {
|
public boolean supports(boolean async) {
|
||||||
return !async;
|
return !async;
|
||||||
@ -49,11 +75,42 @@ public class SyncReport extends AbstractReport {
|
|||||||
.unit(unit)
|
.unit(unit)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NettyResult result = client.reportRetryInfo(Collections.singletonList(retryTaskDTO));
|
try {
|
||||||
LogUtils.debug(log, "Data report result result:[{}]", JsonUtil.toJsonString(result));
|
NettyResult result = client.reportRetryInfo(Collections.singletonList(retryTaskDTO));
|
||||||
|
LogUtils.debug(log, "Data report result result:[{}]", JsonUtil.toJsonString(result));
|
||||||
|
return (Boolean) result.getData();
|
||||||
|
} catch (Exception e) {
|
||||||
|
sendMessage(e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
return (Boolean) result.getData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendMessage(Throwable e) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
ConfigDTO.Notify notifyAttribute = GroupVersionCache.getNotifyAttribute(NotifySceneEnum.CLIENT_REPORT_ERROR.getNotifyScene());
|
||||||
|
if (Objects.isNull(notifyAttribute)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AlarmContext context = AlarmContext.build()
|
||||||
|
.text(reportErrorTextMessageFormatter,
|
||||||
|
EnvironmentUtils.getActiveProfile(),
|
||||||
|
easyRetryProperties.getNamespace(),
|
||||||
|
EasyRetryProperties.getGroup(),
|
||||||
|
LocalDateTime.now().format(formatter),
|
||||||
|
e.getMessage())
|
||||||
|
.title("同步上报异常:[{}]", EasyRetryProperties.getGroup())
|
||||||
|
.notifyAttribute(notifyAttribute.getNotifyAttribute());
|
||||||
|
|
||||||
|
EasyRetryAlarmFactory easyRetryAlarmFactory = SpringContext.getBeanByType(EasyRetryAlarmFactory.class);
|
||||||
|
Alarm<AlarmContext> alarmType = easyRetryAlarmFactory.getAlarmType(notifyAttribute.getNotifyType());
|
||||||
|
alarmType.asyncSendMessage(context);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
LogUtils.error(log, "客户端发送组件异常告警失败", e1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,10 @@ import java.util.function.Consumer;
|
|||||||
public abstract class AbstractRetryStrategies implements RetryStrategy {
|
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> \r\n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试期间发生非预期异常</font> \n" +
|
||||||
"> 名称:{} \r\n" +
|
"> 空间ID:{} \n" +
|
||||||
"> 时间:{} \r\n" +
|
"> 名称:{} \n" +
|
||||||
|
"> 时间:{} \n" +
|
||||||
"> 异常:{} \n"
|
"> 异常:{} \n"
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -52,6 +53,8 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
|
|||||||
private EasyRetryAlarmFactory easyRetryAlarmFactory;
|
private EasyRetryAlarmFactory easyRetryAlarmFactory;
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<Report> reports;
|
private List<Report> reports;
|
||||||
|
@Autowired
|
||||||
|
private EasyRetryProperties easyRetryProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RetryerResultContext openRetry(String sceneName, String executorClassName, Object[] params) {
|
public RetryerResultContext openRetry(String sceneName, String executorClassName, Object[] params) {
|
||||||
@ -176,6 +179,7 @@ public abstract class AbstractRetryStrategies implements RetryStrategy {
|
|||||||
AlarmContext context = AlarmContext.build()
|
AlarmContext context = AlarmContext.build()
|
||||||
.text(retryErrorMoreThresholdTextMessageFormatter,
|
.text(retryErrorMoreThresholdTextMessageFormatter,
|
||||||
EnvironmentUtils.getActiveProfile(),
|
EnvironmentUtils.getActiveProfile(),
|
||||||
|
easyRetryProperties.getNamespace(),
|
||||||
EasyRetryProperties.getGroup(),
|
EasyRetryProperties.getGroup(),
|
||||||
LocalDateTime.now().format(formatter),
|
LocalDateTime.now().format(formatter),
|
||||||
e.getMessage())
|
e.getMessage())
|
||||||
|
@ -53,8 +53,8 @@ public class DingDingUtils {
|
|||||||
request.setMsgtype("markdown");
|
request.setMsgtype("markdown");
|
||||||
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
|
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
|
||||||
markdown.setTitle(title);
|
markdown.setTitle(title);
|
||||||
request.setMarkdown(markdown);
|
|
||||||
markdown.setText(subTextLength(getAtText(ats, text)));
|
markdown.setText(subTextLength(getAtText(ats, text)));
|
||||||
|
request.setMarkdown(markdown);
|
||||||
|
|
||||||
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
|
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
|
||||||
at.setAtMobiles(ats);
|
at.setAtMobiles(ats);
|
||||||
@ -81,9 +81,10 @@ public class DingDingUtils {
|
|||||||
public static boolean sendMessage(OapiRobotSendRequest request, String url) {
|
public static boolean sendMessage(OapiRobotSendRequest request, String url) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (StrUtil.isNotBlank(url)) {
|
if (StrUtil.isBlank(url)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DingTalkClient client = new DefaultDingTalkClient(url);
|
DingTalkClient client = new DefaultDingTalkClient(url);
|
||||||
client.execute(request);
|
client.execute(request);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public abstract class AbstractAlarm<E extends ApplicationEvent, A extends AlarmI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Objects.nonNull(alarmDTO.getCount()) && Objects.nonNull(notifyConfig.getNotifyThreshold())) {
|
if (Objects.nonNull(alarmDTO.getCount()) && Objects.nonNull(notifyConfig.getNotifyThreshold())) {
|
||||||
if (notifyConfig.getNotifyThreshold() > alarmDTO.getCount()) {
|
if (notifyConfig.getNotifyThreshold() >= alarmDTO.getCount()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/scene-config")
|
@RequestMapping("/scene-config")
|
||||||
public class SceneConfigSceneController {
|
public class SceneConfigController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SceneConfigService sceneConfigService;
|
private SceneConfigService sceneConfigService;
|
@ -67,7 +67,7 @@ public class SceneConfigServiceImpl implements SceneConfigService {
|
|||||||
|
|
||||||
List<SceneConfig> sceneConfigs = accessTemplate.getSceneConfigAccess()
|
List<SceneConfig> sceneConfigs = accessTemplate.getSceneConfigAccess()
|
||||||
.list(new LambdaQueryWrapper<SceneConfig>()
|
.list(new LambdaQueryWrapper<SceneConfig>()
|
||||||
.select(SceneConfig::getSceneName, SceneConfig::getDescription)
|
.select(SceneConfig::getSceneName, SceneConfig::getDescription, SceneConfig::getMaxRetryCount)
|
||||||
.eq(SceneConfig::getNamespaceId, namespaceId)
|
.eq(SceneConfig::getNamespaceId, namespaceId)
|
||||||
.eq(SceneConfig::getGroupName, groupName)
|
.eq(SceneConfig::getGroupName, groupName)
|
||||||
.orderByDesc(SceneConfig::getCreateDt));
|
.orderByDesc(SceneConfig::getCreateDt));
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
v-else
|
v-else
|
||||||
id="inputNumber"
|
id="inputNumber"
|
||||||
:min="1"
|
:min="1"
|
||||||
|
:max="maxNotifyThreshold"
|
||||||
style="width: -webkit-fill-available"
|
style="width: -webkit-fill-available"
|
||||||
v-decorator="[
|
v-decorator="[
|
||||||
'notifyThreshold',
|
'notifyThreshold',
|
||||||
@ -63,8 +64,8 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6" :md="12" :sm="24">
|
<a-col :lg="6" :md="12" :sm="24">
|
||||||
<a-form-item label="场景">
|
<a-form-item label="场景">
|
||||||
<a-select :disabled="sceneNameDisabled.includes(this.notifySceneValue)" placeholder="请选择场景" v-decorator="['sceneName', { rules: [{ required: !sceneNameDisabled.includes(this.notifySceneValue), message: '请选择场景' }] }]" >
|
<a-select :disabled="sceneNameDisabled.includes(this.notifySceneValue)" placeholder="请选择场景" v-decorator="['sceneName', { rules: [{ required: !sceneNameDisabled.includes(this.notifySceneValue), message: '请选择场景' }] }]" @select="changeSceneName">
|
||||||
<a-select-option v-for="item in sceneList" :value="item.sceneName" :key="item.sceneName">{{ item.sceneName }}</a-select-option>
|
<a-select-option v-for="item in sceneList" :value="item.sceneName" :maxRetryCount="item.maxRetryCount" :key="item.sceneName">{{ item.sceneName }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
@ -321,7 +322,8 @@ export default {
|
|||||||
notifySceneValue: '1',
|
notifySceneValue: '1',
|
||||||
rateLimiterStatusValue: '0',
|
rateLimiterStatusValue: '0',
|
||||||
defaultRateLimiterStatusValue: '0',
|
defaultRateLimiterStatusValue: '0',
|
||||||
defaultRateLimiterThreshold: '100'
|
defaultRateLimiterThreshold: '100',
|
||||||
|
maxNotifyThreshold: 999
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
@ -365,6 +367,9 @@ export default {
|
|||||||
this.sceneList = res.data
|
this.sceneList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
changeSceneName (value, option) {
|
||||||
|
this.maxNotifyThreshold = option.data.attrs.maxRetryCount
|
||||||
|
},
|
||||||
changeRateLimiterStatus (rateLimiterStatus) {
|
changeRateLimiterStatus (rateLimiterStatus) {
|
||||||
this.rateLimiterStatusValue = rateLimiterStatus
|
this.rateLimiterStatusValue = rateLimiterStatus
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user