add recover_time
This commit is contained in:
parent
2bfc67686d
commit
0e88f0074c
|
@ -318,6 +318,7 @@ CREATE TABLE `alert_his_event` (
|
|||
`target_note` varchar(191) not null default '' comment 'target note',
|
||||
`trigger_time` bigint not null,
|
||||
`trigger_value` varchar(255) not null,
|
||||
`recover_time` bigint not null default 0,
|
||||
`tags` varchar(1024) not null default '' comment 'merge data_tags rule_tags, split by ,,',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY (`hash`),
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
规则名称: {{.RuleName}}{{if .RuleNote}}
|
||||
规则备注: {{.RuleNote}}{{end}}
|
||||
监控指标: {{.TagsJSON}}
|
||||
触发时间: {{timeformat .TriggerTime}}
|
||||
触发时值: {{.TriggerValue}}
|
||||
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}}
|
||||
触发时值: {{.TriggerValue}}{{end}}
|
|
@ -2,5 +2,5 @@
|
|||
规则名称: {{.RuleName}}{{if .RuleNote}}
|
||||
规则备注: {{.RuleNote}}{{end}}
|
||||
监控指标: {{.TagsJSON}}
|
||||
触发时间: {{timeformat .TriggerTime}}
|
||||
触发时值: {{.TriggerValue}}
|
||||
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}}
|
||||
触发时值: {{.TriggerValue}}{{end}}
|
|
@ -162,6 +162,13 @@
|
|||
<th>监控指标:</th>
|
||||
<td>{{.TagsJSON}}</td>
|
||||
</tr>
|
||||
|
||||
{{if .IsRecovered}}
|
||||
<tr>
|
||||
<th>恢复时间:</th>
|
||||
<td>{{timeformat .LastEvalTime}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<th>触发时值:</th>
|
||||
<td>{{.TriggerValue}}</td>
|
||||
|
@ -172,6 +179,8 @@
|
|||
{{timeformat .TriggerTime}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
<tr>
|
||||
<th>PromQL:</th>
|
||||
<td>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
**规则标题**: {{.RuleName}}{{if .RuleNote}}
|
||||
**规则备注**: {{.RuleNote}}{{end}}
|
||||
**监控指标**: {{.TagsJSON}}
|
||||
**触发时间**: {{timeformat .TriggerTime}}
|
||||
**触发时值**: {{.TriggerValue}}
|
||||
{{if .IsRecovered}}**恢复时间**:{{timeformat .LastEvalTime}}{{else}}**触发时间**: {{timeformat .TriggerTime}}
|
||||
**触发时值**: {{.TriggerValue}}{{end}}
|
|
@ -37,7 +37,7 @@ type AlertCurEvent struct {
|
|||
TagsMap map[string]string `json:"-" gorm:"-"` // for internal usage
|
||||
IsRecovered bool `json:"is_recovered" gorm:"-"` // for notify.py
|
||||
NotifyUsersObj []*User `json:"notify_users_obj" gorm:"-"` // for notify.py
|
||||
LastEvalTime int64 `json:"last_eval_time" gorm:"-"` // for internal usage
|
||||
LastEvalTime int64 `json:"last_eval_time" gorm:"-"` // for notify.py
|
||||
}
|
||||
|
||||
func (e *AlertCurEvent) TableName() string {
|
||||
|
@ -80,6 +80,7 @@ func (e *AlertCurEvent) ToHis() *AlertHisEvent {
|
|||
TriggerTime: e.TriggerTime,
|
||||
TriggerValue: e.TriggerValue,
|
||||
Tags: e.Tags,
|
||||
RecoverTime: e.LastEvalTime,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ type AlertHisEvent struct {
|
|||
TargetNote string `json:"target_note"`
|
||||
TriggerTime int64 `json:"trigger_time"`
|
||||
TriggerValue string `json:"trigger_value"`
|
||||
RecoverTime int64 `json:"recover_time"`
|
||||
Tags string `json:"-"`
|
||||
TagsJSON []string `json:"tags" gorm:"-"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue