Alerting: Fetch all applied alerting configurations (#65728)
* WIP * skip invalid historic configurations instead of erroring * add warning log when bad historic config is found * remove unused custom marshaller for GettableHistoricUserConfig * add id to historic user config, move limit check to store, fix typo * swagger spec
This commit is contained in:
@@ -435,6 +435,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/config/history": {
|
||||
"get": {
|
||||
"description": "gets Alerting configurations that were successfully applied in the past",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaAlertingConfigHistory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Limit response to n historic configurations.",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/GettableHistoricUserConfigs"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{DatasourceUID}/api/v2/alerts": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
@@ -2836,9 +2859,9 @@
|
||||
"execErrState": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"OK",
|
||||
"Alerting",
|
||||
"Error",
|
||||
"OK"
|
||||
"Error"
|
||||
]
|
||||
},
|
||||
"for": {
|
||||
@@ -2942,8 +2965,7 @@
|
||||
"$ref": "#/definitions/AlertRuleGroupExport"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$ref": "#/definitions/AlertingFileExport"
|
||||
}
|
||||
},
|
||||
"AlertingRule": {
|
||||
"description": "adapted from cortex",
|
||||
@@ -3178,6 +3200,9 @@
|
||||
"description": "DataLink define what",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"internal": {
|
||||
"$ref": "#/definitions/InternalDataLink"
|
||||
},
|
||||
"targetBlank": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -3365,6 +3390,40 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnumFieldConfig": {
|
||||
"description": "Enum field config\nVector values are used as lookup keys into the enum fields",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"color": {
|
||||
"description": "Color is the color value for a given index (empty is undefined)",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"description": "Description of the enum state",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"icon": {
|
||||
"description": "Icon supports setting an icon for a given index value",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"text": {
|
||||
"description": "Value is the string display value for a given index",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorType": {
|
||||
"type": "string",
|
||||
"title": "ErrorType models the different API error types."
|
||||
@@ -3406,6 +3465,9 @@
|
||||
"EvalQueriesResponse": {
|
||||
"$ref": "#/definitions/EvalQueriesResponse"
|
||||
},
|
||||
"ExplorePanelsState": {
|
||||
"description": "This is an object constructed with the keys as the values of the enum VisType and the value being a bag of properties"
|
||||
},
|
||||
"ExtendedReceiver": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3524,6 +3586,9 @@
|
||||
"thresholds": {
|
||||
"$ref": "#/definitions/ThresholdsConfig"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/FieldTypeConfig"
|
||||
},
|
||||
"unit": {
|
||||
"description": "Numeric Options",
|
||||
"type": "string"
|
||||
@@ -3534,13 +3599,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"FieldTypeConfig": {
|
||||
"description": "FieldTypeConfig has type specific configs, only one should be active at a time",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enum": {
|
||||
"$ref": "#/definitions/EnumFieldConfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Frame": {
|
||||
"description": "Each Field is well typed by its FieldType and supports optional Labels.\n\nA Frame is a general data container for Grafana. A Frame can be table data\nor time series data depending on its content and field types.",
|
||||
"type": "object",
|
||||
"title": "Frame is a columnar data structure where each column is a Field.",
|
||||
"properties": {
|
||||
"Fields": {
|
||||
"description": "Fields are the columns of a frame.\nAll Fields must be of the same the length when marshalling the Frame for transmission.",
|
||||
"description": "Fields are the columns of a frame.\nAll Fields must be of the same the length when marshalling the Frame for transmission.\nThere should be no `nil` entries in the Fields slice (making them pointers was a mistake).",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Field"
|
||||
@@ -3612,6 +3686,9 @@
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/FrameType"
|
||||
},
|
||||
"typeVersion": {
|
||||
"$ref": "#/definitions/FrameTypeVersion"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3619,8 +3696,16 @@
|
||||
"description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.",
|
||||
"type": "string"
|
||||
},
|
||||
"FrameTypeVersion": {
|
||||
"type": "array",
|
||||
"title": "FrameType is a 2 number version (Major / Minor).",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint64"
|
||||
}
|
||||
},
|
||||
"Frames": {
|
||||
"description": "It is the main data container within a backend.DataResponse.",
|
||||
"description": "It is the main data container within a backend.DataResponse.\nThere should be no `nil` entries in the Frames slice (making them pointers was a mistake).",
|
||||
"type": "array",
|
||||
"title": "Frames is a slice of Frame pointers.",
|
||||
"items": {
|
||||
@@ -3911,6 +3996,34 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"GettableHistoricUserConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alertmanager_config": {
|
||||
"$ref": "#/definitions/GettableApiAlertingConfig"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"last_applied": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"template_file_provenances": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Provenance"
|
||||
}
|
||||
},
|
||||
"template_files": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"GettableNGalertConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4173,6 +4286,31 @@
|
||||
"format": "int64",
|
||||
"title": "InspectType is a type for the Inspect property of a Notice."
|
||||
},
|
||||
"InternalDataLink": {
|
||||
"description": "InternalDataLink definition to allow Explore links to be constructed in the backend",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"datasourceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"datasourceUid": {
|
||||
"type": "string"
|
||||
},
|
||||
"panelsState": {
|
||||
"$ref": "#/definitions/ExplorePanelsState"
|
||||
},
|
||||
"query": {},
|
||||
"timeRange": {
|
||||
"$ref": "#/definitions/TimeRange"
|
||||
},
|
||||
"transformations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/LinkTransformationConfig"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Json": {
|
||||
"type": "object"
|
||||
},
|
||||
@@ -4214,6 +4352,23 @@
|
||||
"$ref": "#/definitions/Label"
|
||||
}
|
||||
},
|
||||
"LinkTransformationConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"expression": {
|
||||
"type": "string"
|
||||
},
|
||||
"field": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapValue": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/SupportedTransformationTypes"
|
||||
}
|
||||
}
|
||||
},
|
||||
"MatchRegexps": {
|
||||
"type": "object",
|
||||
"title": "MatchRegexps represents a map of Regexp.",
|
||||
@@ -4938,9 +5093,9 @@
|
||||
"execErrState": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"OK",
|
||||
"Alerting",
|
||||
"Error",
|
||||
"OK"
|
||||
"Error"
|
||||
]
|
||||
},
|
||||
"folderUID": {
|
||||
@@ -5127,6 +5282,9 @@
|
||||
"thresholds": {
|
||||
"$ref": "#/definitions/ThresholdsConfig"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/FieldTypeConfig"
|
||||
},
|
||||
"unit": {
|
||||
"description": "Numeric Options",
|
||||
"type": "string"
|
||||
@@ -5693,6 +5851,9 @@
|
||||
"Success": {
|
||||
"$ref": "#/definitions/ResponseDetails"
|
||||
},
|
||||
"SupportedTransformationTypes": {
|
||||
"type": "string"
|
||||
},
|
||||
"TLSConfig": {
|
||||
"type": "object",
|
||||
"title": "TLSConfig configures the options for TLS connections.",
|
||||
@@ -5932,22 +6093,21 @@
|
||||
}
|
||||
},
|
||||
"TimeRange": {
|
||||
"description": "For example, 4:00PM to End of the day would Begin at 1020 and End at 1440.",
|
||||
"description": "Redefining this to avoid an import cycle",
|
||||
"type": "object",
|
||||
"title": "TimeRange represents a range of minutes within a 1440 minute day, exclusive of the End minute. A day consists of 1440 minutes.",
|
||||
"properties": {
|
||||
"EndMinute": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
"from": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"StartMinute": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
"to": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
},
|
||||
"URL": {
|
||||
"description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.",
|
||||
"description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the EscapedPath method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.",
|
||||
"type": "object",
|
||||
"title": "A URL represents a parsed URL (technically, a URI reference).",
|
||||
"properties": {
|
||||
@@ -6290,7 +6450,6 @@
|
||||
}
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"labels",
|
||||
@@ -6347,7 +6506,6 @@
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
@@ -6355,7 +6513,6 @@
|
||||
"$ref": "#/definitions/gettableAlerts"
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"comment",
|
||||
@@ -6405,7 +6562,6 @@
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
},
|
||||
"gettableSilences": {
|
||||
"description": "GettableSilences gettable silences",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
@@ -6413,7 +6569,6 @@
|
||||
"$ref": "#/definitions/gettableSilences"
|
||||
},
|
||||
"integration": {
|
||||
"description": "Integration integration",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
@@ -6558,6 +6713,7 @@
|
||||
}
|
||||
},
|
||||
"postableSilence": {
|
||||
"description": "PostableSilence postable silence",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"comment",
|
||||
@@ -6711,6 +6867,15 @@
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"GettableHistoricUserConfigs": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/GettableHistoricUserConfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
"receiversResponse": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
|
||||
Reference in New Issue
Block a user