Alerting: Template Testing API (#67450)

This commit is contained in:
Matthew Jacobson
2023-04-28 15:56:59 +01:00
committed by GitHub
parent 9eb10bee1f
commit 91471ac7ae
19 changed files with 847 additions and 78 deletions
+106 -5
View File
@@ -299,6 +299,10 @@
"AlertingRule": {
"description": "adapted from cortex",
"properties": {
"activeAt": {
"format": "date-time",
"type": "string"
},
"alerts": {
"items": {
"$ref": "#/definitions/Alert"
@@ -339,6 +343,20 @@
"description": "State can be \"pending\", \"firing\", \"inactive\".",
"type": "string"
},
"totals": {
"additionalProperties": {
"format": "int64",
"type": "integer"
},
"type": "object"
},
"totalsFiltered": {
"additionalProperties": {
"format": "int64",
"type": "integer"
},
"type": "object"
},
"type": {
"$ref": "#/definitions/RuleType"
}
@@ -350,7 +368,7 @@
"type",
"state",
"annotations",
"alerts"
"activeAt"
],
"type": "object"
},
@@ -2845,6 +2863,13 @@
"$ref": "#/definitions/RuleGroup"
},
"type": "array"
},
"totals": {
"additionalProperties": {
"format": "int64",
"type": "integer"
},
"type": "object"
}
},
"required": [
@@ -2878,6 +2903,13 @@
"$ref": "#/definitions/AlertingRule"
},
"type": "array"
},
"totals": {
"additionalProperties": {
"format": "int64",
"type": "integer"
},
"type": "object"
}
},
"required": [
@@ -3343,6 +3375,77 @@
},
"type": "object"
},
"TestTemplatesConfigBodyParams": {
"properties": {
"alerts": {
"description": "Alerts to use as data when testing the template.",
"items": {
"$ref": "#/definitions/postableAlert"
},
"type": "array"
},
"name": {
"description": "Name of the template file.",
"type": "string"
},
"template": {
"description": "Template string to test.",
"type": "string"
}
},
"type": "object"
},
"TestTemplatesErrorResult": {
"properties": {
"kind": {
"description": "Kind of template error that occurred.",
"enum": [
"invalid_template",
"execution_error"
],
"type": "string"
},
"message": {
"description": "Error message.",
"type": "string"
},
"name": {
"description": "Name of the associated template for this error. Will be empty if the Kind is \"invalid_template\".",
"type": "string"
}
},
"type": "object"
},
"TestTemplatesResult": {
"properties": {
"name": {
"description": "Name of the associated template definition for this result.",
"type": "string"
},
"text": {
"description": "Interpolated value of the template.",
"type": "string"
}
},
"type": "object"
},
"TestTemplatesResults": {
"properties": {
"errors": {
"items": {
"$ref": "#/definitions/TestTemplatesErrorResult"
},
"type": "array"
},
"results": {
"items": {
"$ref": "#/definitions/TestTemplatesResult"
},
"type": "array"
}
},
"type": "object"
},
"Threshold": {
"description": "Threshold a single step on the threshold list",
"properties": {
@@ -3644,7 +3747,6 @@
"type": "object"
},
"alertGroup": {
"description": "AlertGroup alert group",
"properties": {
"alerts": {
"description": "alerts",
@@ -3829,13 +3931,13 @@
"type": "object"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"type": "array"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"properties": {
"comment": {
"description": "comment",
@@ -3891,7 +3993,6 @@
"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",
@@ -4035,7 +4136,6 @@
"type": "array"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"properties": {
"comment": {
"description": "comment",
@@ -4073,6 +4173,7 @@
"type": "object"
},
"receiver": {
"description": "Receiver receiver",
"properties": {
"active": {
"description": "active",