[alerter] 告警处理指标数据,告警表达式计算,内容模版关键字替换

This commit is contained in:
tomsun28
2021-12-10 12:54:42 +08:00
parent 29b3e23d02
commit 370224f5cf
23 changed files with 693 additions and 44 deletions

View File

@@ -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);
}