extracts alertmanager from DI, including migrations (#34071)
* extracts alertmanager from DI, including migrations * includes alertmanager Run method in ngalert * removes 3s test shutdown timeout * lint
This commit is contained in:
@@ -17,6 +17,9 @@ func AddTablesMigrations(mg *migrator.Migrator) {
|
||||
// Create alert_rule
|
||||
AddAlertRuleMigrations(mg, 60)
|
||||
AddAlertRuleVersionMigrations(mg)
|
||||
|
||||
// Create Alertmanager configurations
|
||||
AddAlertmanagerConfigMigrations(mg)
|
||||
}
|
||||
|
||||
// AddAlertDefinitionMigrations should not be modified.
|
||||
@@ -235,3 +238,17 @@ func AddAlertRuleVersionMigrations(mg *migrator.Migrator) {
|
||||
// add labels column
|
||||
mg.AddMigration("add column labels to alert_rule_version", migrator.NewAddColumnMigration(alertRuleVersion, &migrator.Column{Name: "labels", Type: migrator.DB_Text, Nullable: true}))
|
||||
}
|
||||
|
||||
func AddAlertmanagerConfigMigrations(mg *migrator.Migrator) {
|
||||
alertConfiguration := migrator.Table{
|
||||
Name: "alert_configuration",
|
||||
Columns: []*migrator.Column{
|
||||
{Name: "id", Type: migrator.DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
{Name: "alertmanager_configuration", Type: migrator.DB_Text, Nullable: false},
|
||||
{Name: "configuration_version", Type: migrator.DB_NVarchar, Length: 3}, // In a format of vXX e.g. v1, v2, v10, etc
|
||||
{Name: "created_at", Type: migrator.DB_Int, Nullable: false},
|
||||
},
|
||||
}
|
||||
|
||||
mg.AddMigration("create_alert_configuration_table", migrator.NewAddTableMigration(alertConfiguration))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user