优化重试中数据监控
This commit is contained in:
byteblogs168 2023-01-14 20:47:58 +08:00
parent db09bc4d9c
commit 69ef41cbaf
3 changed files with 8 additions and 6 deletions

View File

@ -12,6 +12,7 @@ public interface RetryTaskMapper extends BaseMapper<RetryTask> {
int deleteBatch(@Param("ids") List<Long> ids, @Param("partition") Integer partition);
int countAllRetryTask(@Param("partition") Integer partition);
int countAllRetryTaskByRetryStatus(@Param("partition") Integer partition,
@Param("retryStatus") Integer retryStatus);
}

View File

@ -4,6 +4,7 @@ import com.x.retry.common.core.alarm.Alarm;
import com.x.retry.common.core.alarm.AlarmContext;
import com.x.retry.common.core.alarm.AltinAlarmFactory;
import com.x.retry.common.core.enums.NotifySceneEnum;
import com.x.retry.common.core.enums.RetryStatusEnum;
import com.x.retry.common.core.log.LogUtils;
import com.x.retry.common.core.util.EnvironmentUtils;
import com.x.retry.common.core.util.HostUtils;
@ -69,7 +70,7 @@ public class AlarmNotifyThreadSchedule {
continue;
}
int count = retryTaskMapper.countAllRetryTask(groupConfig.getGroupPartition());
int count = retryTaskMapper.countAllRetryTaskByRetryStatus(groupConfig.getGroupPartition(), RetryStatusEnum.RUNNING.getLevel());
if (count > notifyConfig.getNotifyThreshold()) {
// 预警
AlarmContext context = AlarmContext.build()

View File

@ -51,10 +51,10 @@
<include refid="Base_Column_List" />
from retry_task_${partition} where retry_status = #{retryStatus,jdbcType=TINYINT} limit 1000
</select>
<select id="countAllRetryTask" resultType="int">
<select id="countAllRetryTaskByRetryStatus" resultType="int">
select
count(*)
from retry_task_${partition}
from retry_task_${partition} where retry_status = #{retryStatus}
</select>
<select id="selectRetryTaskByGroupIdAndSceneId" resultMap="BaseResultMap">
select