mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
adds db migration for debounce_duration
This commit is contained in:
parent
ccfd9c89b2
commit
2d3a575489
@ -59,19 +59,20 @@ func (s ExecutionErrorOption) ToAlertState() AlertStateType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Alert struct {
|
type Alert struct {
|
||||||
Id int64
|
Id int64
|
||||||
Version int64
|
Version int64
|
||||||
OrgId int64
|
OrgId int64
|
||||||
DashboardId int64
|
DashboardId int64
|
||||||
PanelId int64
|
PanelId int64
|
||||||
Name string
|
Name string
|
||||||
Message string
|
Message string
|
||||||
Severity string
|
Severity string //Unused
|
||||||
State AlertStateType
|
State AlertStateType
|
||||||
Handler int64
|
Handler int64 //Unused
|
||||||
Silenced bool
|
Silenced bool
|
||||||
ExecutionError string
|
ExecutionError string
|
||||||
Frequency int64
|
Frequency int64
|
||||||
|
DebounceDuration time.Duration
|
||||||
|
|
||||||
EvalData *simplejson.Json
|
EvalData *simplejson.Json
|
||||||
NewStateDate time.Time
|
NewStateDate time.Time
|
||||||
|
@ -104,7 +104,7 @@ func NewRuleFromDBAlert(ruleDef *m.Alert) (*Rule, error) {
|
|||||||
model.Frequency = ruleDef.Frequency
|
model.Frequency = ruleDef.Frequency
|
||||||
model.State = ruleDef.State
|
model.State = ruleDef.State
|
||||||
model.LastStateChange = ruleDef.NewStateDate
|
model.LastStateChange = ruleDef.NewStateDate
|
||||||
model.DebounceDuration = time.Minute * 2 // hard coded for now
|
model.DebounceDuration = time.Duration(ruleDef.DebounceDuration)
|
||||||
model.NoDataState = m.NoDataOption(ruleDef.Settings.Get("noDataState").MustString("no_data"))
|
model.NoDataState = m.NoDataOption(ruleDef.Settings.Get("noDataState").MustString("no_data"))
|
||||||
model.ExecutionErrorState = m.ExecutionErrorOption(ruleDef.Settings.Get("executionErrorState").MustString("alerting"))
|
model.ExecutionErrorState = m.ExecutionErrorOption(ruleDef.Settings.Get("executionErrorState").MustString("alerting"))
|
||||||
model.StateChanges = ruleDef.StateChanges
|
model.StateChanges = ruleDef.StateChanges
|
||||||
|
@ -133,4 +133,8 @@ func addAlertMigrations(mg *Migrator) {
|
|||||||
mg.AddMigration("create alert_notification_state table v1", NewAddTableMigration(alert_notification_state))
|
mg.AddMigration("create alert_notification_state table v1", NewAddTableMigration(alert_notification_state))
|
||||||
mg.AddMigration("add index alert_notification_state org_id & alert_id & notifier_id",
|
mg.AddMigration("add index alert_notification_state org_id & alert_id & notifier_id",
|
||||||
NewAddIndexMigration(alert_notification_state, alert_notification_state.Indices[0]))
|
NewAddIndexMigration(alert_notification_state, alert_notification_state.Indices[0]))
|
||||||
|
|
||||||
|
mg.AddMigration("Add decounce_duration to alert table", NewAddColumnMigration(alertV1, &Column{
|
||||||
|
Name: "debounce_duration", Type: DB_BigInt, Nullable: true,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user