[v9.4.x] Alerting: Allow pausing alerts from provisioning (#62492)

Alerting: Allow pausing alerts from provisioning (#62263)

* Allow pausing alerts from provisioning

* Update swagger

* Add IsPaused to provision export endpoints

* Add pause field in sample.yml

* Add exception for reset state in first loop iteration of scheduler if rule is paused

* Update provision definition and swagger docs

* Fix provisioning export tests

* Suggestion: Simplify if condition

* Add more context to a comment

(cherry picked from commit 7a465f42a6)

Co-authored-by: Alex Moreno <alexander.moreno@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2023-01-30 17:01:37 +01:00
committed by GitHub
co-authored by Alex Moreno
parent 992e5d72ff
commit 04dd4e7f7c
9 changed files with 89 additions and 44 deletions
+34 -23
View File
@@ -194,6 +194,9 @@
"for": {
"$ref": "#/definitions/Duration"
},
"isPaused": {
"type": "boolean"
},
"labels": {
"additionalProperties": {
"type": "string"
@@ -219,19 +222,7 @@
"type": "string"
}
},
"title": "AlertRuleExport is the provisioned export of models.AlertRule.",
"type": "object"
},
"AlertRuleFileExport": {
"properties": {
"groups": {
"items": {
"$ref": "#/definitions/AlertRuleGroupExport"
},
"type": "array"
}
},
"title": "AlertRuleFileExport is the provisioned export of multiple models.AlertRuleGroup.",
"title": "AlertRuleExport is the provisioned file export of models.AlertRule.",
"type": "object"
},
"AlertRuleGroup": {
@@ -277,7 +268,7 @@
"type": "array"
}
},
"title": "AlertRuleGroupExport is the provisioned export of models.AlertRuleGroup.",
"title": "AlertRuleGroupExport is the provisioned file export of AlertRuleGroupV1.",
"type": "object"
},
"AlertRuleGroupMetadata": {
@@ -289,6 +280,22 @@
},
"type": "object"
},
"AlertingFileExport": {
"properties": {
"apiVersion": {
"format": "int64",
"type": "integer"
},
"groups": {
"items": {
"$ref": "#/definitions/AlertRuleGroupExport"
},
"type": "array"
}
},
"title": "AlertingFileExport is the full provisioned file export.",
"type": "object"
},
"AlertingRule": {
"description": "adapted from cortex",
"properties": {
@@ -2272,6 +2279,10 @@
"format": "int64",
"type": "integer"
},
"isPaused": {
"example": false,
"type": "boolean"
},
"labels": {
"additionalProperties": {
"type": "string"
@@ -3510,6 +3521,7 @@
"type": "object"
},
"alertGroups": {
"description": "AlertGroups alert groups",
"items": {
"$ref": "#/definitions/alertGroup"
},
@@ -3675,7 +3687,6 @@
"type": "array"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"properties": {
"comment": {
"description": "comment",
@@ -3724,13 +3735,13 @@
"type": "object"
},
"gettableSilences": {
"description": "GettableSilences gettable silences",
"items": {
"$ref": "#/definitions/gettableSilence"
},
"type": "array"
},
"integration": {
"description": "Integration integration",
"properties": {
"lastNotifyAttempt": {
"description": "A timestamp indicating the last attempt to deliver a notification regardless of the outcome.\nFormat: date-time",
@@ -3874,6 +3885,7 @@
"type": "array"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"properties": {
"comment": {
"description": "comment",
@@ -3911,7 +3923,6 @@
"type": "object"
},
"receiver": {
"description": "Receiver receiver",
"properties": {
"active": {
"description": "active",
@@ -5772,9 +5783,9 @@
],
"responses": {
"200": {
"description": "AlertRuleFileExport",
"description": "AlertingFileExport",
"schema": {
"$ref": "#/definitions/AlertRuleFileExport"
"$ref": "#/definitions/AlertingFileExport"
}
},
"404": {
@@ -5908,9 +5919,9 @@
],
"responses": {
"200": {
"description": "AlertRuleExport",
"description": "AlertingFileExport",
"schema": {
"$ref": "#/definitions/AlertRuleExport"
"$ref": "#/definitions/AlertingFileExport"
}
},
"404": {
@@ -6157,9 +6168,9 @@
],
"responses": {
"200": {
"description": "AlertRuleGroupExport",
"description": "AlertingFileExport",
"schema": {
"$ref": "#/definitions/AlertRuleGroupExport"
"$ref": "#/definitions/AlertingFileExport"
}
},
"404": {