grafana/pkg/services/ngalert/migration
Matthew Jacobson 71e70c424f
Alerting: During legacy migration reduce the number of created silences (#78505)
* Alerting: During legacy migration reduce the number of created silences

During legacy migration every migrated rule was given a label rule_uid=<uid>.
This was used to silence DatasourceError/DatasourceNoData alerts for
migrated rules that had either ExecutionErrorState/NoDataState set to
keep_state, respectively.

This could potentially create a large amount of silences and a high cardinality
label. Both of these scenarios have poor outcomes for CPU load and latency in
unified alerting.

Instead, this change creates one label per ExecutionErrorState/NoDataState when
they are set to keep_state as well as two silence rules, if rules with said
labels were created during migration. These silence rules are:

- __legacy_silence_error_keep_state__ = true
- __legacy_silence_nodata_keep_state__ = true

This will drastically reduce the number of created silence rules in most cases
as well as not create the potentially high cardinality label `rule_uid`.
2024-01-24 15:56:19 -05:00
..
models Alerting: Guided legacy alerting upgrade dry-run (#80071) 2024-01-05 18:19:12 -05:00
store Chore: Remove public vars in setting package (#81018) 2024-01-23 12:36:22 +01:00
alert_rule_test.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
alert_rule.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
channel_test.go Chore: Remove public vars in setting package (#81018) 2024-01-23 12:36:22 +01:00
channel.go Chore: Remove public vars in setting package (#81018) 2024-01-23 12:36:22 +01:00
cond_trans_test.go Alerting: In migration, create one label per channel (#76527) 2023-12-19 13:25:13 -05:00
cond_trans.go Alerting: Refactor migration to return pairs of legacy and upgraded structs (#79719) 2024-01-05 05:37:13 -05:00
migration_test.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
models.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
permissions_test.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
permissions.go Alerting: Guided legacy alerting upgrade dry-run (#80071) 2024-01-05 18:19:12 -05:00
persist.go Alerting: Guided legacy alerting upgrade dry-run (#80071) 2024-01-05 18:19:12 -05:00
securejsondata.go Chore: Remove public vars in setting package (#81018) 2024-01-23 12:36:22 +01:00
service_test.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
service.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
silences_test.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
silences.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
template_test.go Alerting: Handle edge cases without panicking during template migration (#76890) 2023-11-02 13:24:54 -04:00
template.go Alerting: Handle edge cases without panicking during template migration (#76890) 2023-11-02 13:24:54 -04:00
testing.go Alerting: During legacy migration reduce the number of created silences (#78505) 2024-01-24 15:56:19 -05:00
ualert_test.go Alerting: Refactor migration to return pairs of legacy and upgraded structs (#79719) 2024-01-05 05:37:13 -05:00
ualert.go Alerting: Refactor migration to return pairs of legacy and upgraded structs (#79719) 2024-01-05 05:37:13 -05:00