[alerter] 告警处理指标数据,告警表达式计算,内容模版关键字替换
This commit is contained in:
@@ -3,7 +3,10 @@ package com.usthe.alert.dao;
|
||||
import com.usthe.alert.pojo.entity.AlertDefine;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -18,4 +21,15 @@ public interface AlertDefineDao extends JpaRepository<AlertDefine, Long>, JpaSpe
|
||||
* @param alertDefineIds 告警定义ID列表
|
||||
*/
|
||||
void deleteAllByIdIn(Set<Long> alertDefineIds);
|
||||
|
||||
/**
|
||||
* 根据监控ID查询与之关联的告警定义列表
|
||||
* @param monitorId 监控ID
|
||||
* @param metrics 指标组
|
||||
* @return 告警定义列表
|
||||
*/
|
||||
@Query("select define from AlertDefine define join AlertDefineBind bind on bind.alertDefineId = define.id " +
|
||||
"where bind.monitorId = :monitorId and define.metric = :metrics")
|
||||
List<AlertDefine> queryAlertDefinesByMonitor(@Param(value = "monitorId") Long monitorId,
|
||||
@Param(value = "metrics") String metrics);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user