[alerter] 告警定义批量接口

This commit is contained in:
tomsun28
2021-12-12 10:32:40 +08:00
parent 8076787e07
commit 4586eba054
6 changed files with 107 additions and 7 deletions

View File

@@ -67,7 +67,7 @@ public interface AlertDefineService {
* @param pageRequest 分页参数
* @return 查询结果
*/
Page<AlertDefine> getAlertDefines(Specification<AlertDefine> specification, PageRequest pageRequest);
Page<AlertDefine> getMonitorBindAlertDefines(Specification<AlertDefine> specification, PageRequest pageRequest);
/**
* 应用告警定于与监控关联关系
@@ -83,5 +83,13 @@ public interface AlertDefineService {
* @param metrics 指标组
* @return field - define[]
*/
Map<String, List<AlertDefine>> getAlertDefines(long monitorId, String app, String metrics);
Map<String, List<AlertDefine>> getMonitorBindAlertDefines(long monitorId, String app, String metrics);
/**
* 动态条件查询
* @param specification 查询条件
* @param pageRequest 分页参数
* @return 查询结果
*/
Page<AlertDefine> getAlertDefines(Specification<AlertDefine> specification, PageRequest pageRequest);
}

View File

@@ -68,7 +68,7 @@ public class AlertDefineServiceImpl implements AlertDefineService {
}
@Override
public Page<AlertDefine> getAlertDefines(Specification<AlertDefine> specification, PageRequest pageRequest) {
public Page<AlertDefine> getMonitorBindAlertDefines(Specification<AlertDefine> specification, PageRequest pageRequest) {
return alertDefineDao.findAll(specification, pageRequest);
}
@@ -87,7 +87,7 @@ public class AlertDefineServiceImpl implements AlertDefineService {
}
@Override
public Map<String, List<AlertDefine>> getAlertDefines(long monitorId, String app, String metrics) {
public Map<String, List<AlertDefine>> getMonitorBindAlertDefines(long monitorId, String app, String metrics) {
List<AlertDefine> defines = alertDefineDao.queryAlertDefinesByMonitor(monitorId, metrics);
if (defines == null || defines.isEmpty()) {
return null;
@@ -96,4 +96,9 @@ public class AlertDefineServiceImpl implements AlertDefineService {
return defines.stream().sorted(Comparator.comparing(AlertDefine::getPriority))
.collect(Collectors.groupingBy(AlertDefine::getField));
}
@Override
public Page<AlertDefine> getAlertDefines(Specification<AlertDefine> specification, PageRequest pageRequest) {
return alertDefineDao.findAll(specification, pageRequest);
}
}