Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
nightingale
提交
598ae07f
N
nightingale
项目概览
DiDi
/
nightingale
12 个月 前同步成功
通知
46
Star
7053
Fork
1161
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nightingale
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
598ae07f
编写于
1月 26, 2022
作者:
U
Ulric Qin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add feature: recover_duration
上级
e5d7612a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
7 addition
and
0 deletion
+7
-0
docker/initsql/a-n9e.sql
docker/initsql/a-n9e.sql
+1
-0
src/models/alert_rule.go
src/models/alert_rule.go
+1
-0
src/server/engine/worker.go
src/server/engine/worker.go
+5
-0
未找到文件。
docker/initsql/a-n9e.sql
浏览文件 @
598ae07f
...
...
@@ -212,6 +212,7 @@ CREATE TABLE `alert_rule` (
`notify_channels`
varchar
(
255
)
not
null
default
''
comment
'split by space: sms voice email dingtalk wecom'
,
`notify_groups`
varchar
(
255
)
not
null
default
''
comment
'split by space: 233 43'
,
`notify_repeat_step`
int
not
null
default
0
comment
'unit: min'
,
`recover_duration`
int
not
null
default
0
comment
'unit: s'
,
`callbacks`
varchar
(
255
)
not
null
default
''
comment
'split by space: http://a.com/api/x http://a.com/api/y'
,
`runbook_url`
varchar
(
255
),
`append_tags`
varchar
(
255
)
not
null
default
''
comment
'split by space: service=n9e mod=api'
,
...
...
src/models/alert_rule.go
浏览文件 @
598ae07f
...
...
@@ -36,6 +36,7 @@ type AlertRule struct {
NotifyGroupsObj
[]
UserGroup
`json:"notify_groups_obj" gorm:"-"`
// for fe
NotifyGroupsJSON
[]
string
`json:"notify_groups" gorm:"-"`
// for fe
NotifyRepeatStep
int
`json:"notify_repeat_step"`
// notify repeat interval, unit: min
RecoverDuration
int64
`json:"recover_duration"`
// unit: s
Callbacks
string
`json:"-"`
// split by space: http://a.com/api/x http://a.com/api/y'
CallbacksJSON
[]
string
`json:"callbacks" gorm:"-"`
// for fe
RunbookUrl
string
`json:"runbook_url"`
// sop url
...
...
src/server/engine/worker.go
浏览文件 @
598ae07f
...
...
@@ -343,6 +343,11 @@ func (r RuleEval) recoverRule(alertingKeys map[string]struct{}, now int64) {
continue
}
// 如果配置了留观时长,就不能立马恢复了
if
r
.
rule
.
RecoverDuration
>
0
&&
now
-
event
.
LastEvalTime
<=
r
.
rule
.
RecoverDuration
{
continue
}
// 没查到触发阈值的vector,姑且就认为这个vector的值恢复了
// 我确实无法分辨,是prom中有值但是未满足阈值所以没返回,还是prom中确实丢了一些点导致没有数据可以返回,尴尬
delete
(
r
.
fires
,
hash
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录