Merge branch 'master' of github.com:didi/nightingale

This commit is contained in:
UlricQin 2021-09-04 16:21:01 +08:00
commit ee859df057
2 changed files with 15 additions and 17 deletions

View File

@ -4,20 +4,18 @@ import (
"encoding/json" "encoding/json"
"strings" "strings"
//"github.com/didi/nightingale/v5/vos"
"github.com/toolkits/pkg/logger" "github.com/toolkits/pkg/logger"
"xorm.io/builder" "xorm.io/builder"
) )
type HistoryAlertEvent struct { type HistoryAlertEvent struct {
Id int64 `json:"id"` Id int64 `json:"id"`
RuleId int64 `json:"rule_id"` RuleId int64 `json:"rule_id"`
RuleName string `json:"rule_name"` RuleName string `json:"rule_name"`
RuleNote string `json:"rule_note"` RuleNote string `json:"rule_note"`
ProcessorUid int64 `json:"processor_uid"` //ProcessorUid int64 `json:"processor_uid"`
ProcessorObj User `json:"processor_user_objs" xorm:"-"` //ProcessorObj User `json:"processor_user_objs" xorm:""`
EventNote string `json:"event_note"` //EventNote string `json:"event_note"`
HashId string `json:"hash_id"` // 唯一标识 HashId string `json:"hash_id"` // 唯一标识
IsPromePull int `json:"is_prome_pull"` // 代表是否是prometheus pull告警为1时前端使用 ReadableExpression 拉取最近1小时数据 IsPromePull int `json:"is_prome_pull"` // 代表是否是prometheus pull告警为1时前端使用 ReadableExpression 拉取最近1小时数据
ResClasspaths string `json:"res_classpaths"` ResClasspaths string `json:"res_classpaths"`
@ -82,13 +80,15 @@ func (hae *HistoryAlertEvent) FillObjs() error {
hae.NotifyUserObjs = users hae.NotifyUserObjs = users
} }
if hae.ProcessorUid != 0 { /*
processor, err := UserGetById(hae.ProcessorUid) if hae.ProcessorUid != 0 {
if err != nil { processor, err := UserGetById(hae.ProcessorUid)
return err if err != nil {
return err
}
hae.ProcessorObj = *processor
} }
hae.ProcessorObj = *processor */
}
return nil return nil
} }

View File

@ -321,8 +321,6 @@ CREATE TABLE `history_alert_event` (
`rule_id` bigint unsigned not null, `rule_id` bigint unsigned not null,
`rule_name` varchar(255) not null, `rule_name` varchar(255) not null,
`rule_note` varchar(512) not null default 'alert rule note', `rule_note` varchar(512) not null default 'alert rule note',
`processor_uid` bigint not null default 0,
`event_note` varchar(512) not null default 'alert event note',
`res_classpaths` varchar(1024) not null default '' COMMENT 'belong classpaths', `res_classpaths` varchar(1024) not null default '' COMMENT 'belong classpaths',
`priority` tinyint(1) not null, `priority` tinyint(1) not null,
`status` tinyint(1) not null, `status` tinyint(1) not null,