Skip to content

Commit

Permalink
feat: alert_subscribe support note and disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo committed Nov 8, 2023
1 parent cc80f5b commit cfa78dc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions center/router/router_alert_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (rt *Router) alertSubscribePut(c *gin.Context) {
"severities",
"extra_config",
"busi_groups",
"note",
))
}

Expand Down
4 changes: 4 additions & 0 deletions memsto/alert_subscribe_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func (c *AlertSubscribeCacheType) syncAlertSubscribes() error {
subs := make(map[int64][]*models.AlertSubscribe)

for i := 0; i < len(lst); i++ {
if lst[i].Disabled == 1 {
continue
}

err = lst[i].Parse()
if err != nil {
logger.Warningf("failed to parse alert subscribe, id: %d", lst[i].Id)
Expand Down
1 change: 1 addition & 0 deletions models/alert_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type AlertSubscribe struct {
WebhooksJson []string `json:"webhooks" gorm:"-"`
ExtraConfig string `json:"-" grom:"extra_config"`
ExtraConfigJson interface{} `json:"extra_config" gorm:"-"` // for fe
Note string `json:"note"`
CreateBy string `json:"create_by"`
CreateAt int64 `json:"create_at"`
UpdateBy string `json:"update_by"`
Expand Down
1 change: 1 addition & 0 deletions models/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type AlertSubscribe struct {
ExtraConfig string `gorm:"type:text;column:extra_config"` // extra config
Severities string `gorm:"column:severities;type:varchar(32);not null;default:''"`
BusiGroups ormx.JSONArr `gorm:"column:busi_groups;type:varchar(4096);not null;default:'[]'"`
Note string `gorm:"column:note;type:varchar(1024);default:'';comment:note"`
}

type AlertMute struct {
Expand Down

0 comments on commit cfa78dc

Please sign in to comment.