Skip to content

Commit

Permalink
fix: alert_cur_event return unmarshal json err (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinguoyi authored Aug 12, 2024
1 parent 7a2832c commit bfea83a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions models/alert_cur_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,12 @@ func (e *AlertCurEvent) DB2FE() error {
e.CallbacksJSON = strings.Fields(e.Callbacks)
e.TagsJSON = strings.Split(e.Tags, ",,")
e.OriginalTagsJSON = strings.Split(e.OriginalTags, ",,")
json.Unmarshal([]byte(e.Annotations), &e.AnnotationsJSON)
json.Unmarshal([]byte(e.RuleConfig), &e.RuleConfigJson)
if err := json.Unmarshal([]byte(e.Annotations), &e.AnnotationsJSON); err != nil {
return err
}
if err := json.Unmarshal([]byte(e.RuleConfig), &e.RuleConfigJson); err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -617,8 +621,8 @@ func AlertCurEventGetMap(ctx *ctx.Context, cluster string) (map[int64]map[string
return ret, nil
}

func (m *AlertCurEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error {
return DB(ctx).Model(m).Updates(fields).Error
func (e *AlertCurEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error {
return DB(ctx).Model(e).Updates(fields).Error
}

func AlertCurEventUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error {
Expand Down

0 comments on commit bfea83a

Please sign in to comment.