Alerting: Extend PUT rule-group route to write the entire rule group rather than top-level fields only (#53078) (#53554)

* Wire up to full alert rule struct

* Extract group change detection logic to dedicated file

* GroupDiff -> GroupDelta for consistency

* Calculate deltas and handle backwards compatible requests

* Separate changes and insert/update/delete as needed

* Regenerate files

* Don't touch the DB if there are no changes

* Quota checking, delete unused file

* Mark modified records as provisioned

* Validation + a couple API layer tests

* Address linter errors

* Fix issue with UID assignment and rule creation

* Propagate top level group fields to all rules

* Tests for repeated updates and versioning

* Tests for quota and provenance checks

* Fix linter errors

* Regenerate

* Factor out some shared logic

* Drop unnecessary multiple nilchecks

* Use alternative strategy for rolling UIDs on inserted rules

* Fix tests, add back nilcheck, refresh UIDs during test

* Address feedback

* Add missing nil-check

(cherry picked from commit b198559225)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-08-10 17:32:54 -05:00
committed by GitHub
co-authored by Alexander Weaver
parent 57e60ffed6
commit aa321e74f6
12 changed files with 373 additions and 37 deletions
+3 -5
View File
@@ -3092,7 +3092,6 @@
"type": "object"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"items": {
"$ref": "#/definitions/gettableAlert"
},
@@ -3258,7 +3257,6 @@
"type": "array"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"properties": {
"comment": {
"description": "comment",
@@ -3707,15 +3705,15 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRuleGroupMetadata"
"$ref": "#/definitions/AlertRuleGroup"
}
}
],
"responses": {
"200": {
"description": "AlertRuleGroupMetadata",
"description": "AlertRuleGroup",
"schema": {
"$ref": "#/definitions/AlertRuleGroupMetadata"
"$ref": "#/definitions/AlertRuleGroup"
}
},
"400": {