Alerting: modify prometheus endpoints for proxying using the datasource UID (#48052)

* Modify prometheus endpoints to expect the data source UID

* Update frontend
This commit is contained in:
Sofia Papagiannaki
2022-05-06 15:05:02 -04:00
committed by GitHub
parent 30d9cc81ec
commit bb66c03f9a
11 changed files with 73 additions and 92 deletions
+16 -16
View File
@@ -1070,7 +1070,7 @@
}
}
},
"/api/prometheus/{DatasourceID}/api/v1/alerts": {
"/api/prometheus/{DatasourceUID}/api/v1/alerts": {
"get": {
"description": "gets the current alerts",
"tags": [
@@ -1079,10 +1079,9 @@
"operationId": "RouteGetAlertStatuses",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -1097,7 +1096,7 @@
}
}
},
"/api/prometheus/{DatasourceID}/api/v1/rules": {
"/api/prometheus/{DatasourceUID}/api/v1/rules": {
"get": {
"description": "gets the evaluation statuses of all rules",
"tags": [
@@ -1106,10 +1105,9 @@
"operationId": "RouteGetRuleStatuses",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -4864,9 +4862,8 @@
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"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.",
"type": "object",
"title": "A URL represents a parsed URL (technically, a URI reference).",
"title": "URL is a custom URL type that allows validation at configuration load time.",
"properties": {
"ForceQuery": {
"type": "boolean"
@@ -4899,7 +4896,7 @@
"$ref": "#/definitions/Userinfo"
}
},
"x-go-package": "net/url"
"x-go-package": "github.com/prometheus/common/config"
},
"Userinfo": {
"description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.",
@@ -5096,7 +5093,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": [
"alerts",
@@ -5119,6 +5115,8 @@
"$ref": "#/definitions/receiver"
}
},
"x-go-name": "AlertGroup",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/alertGroup"
},
"alertGroups": {
@@ -5312,11 +5310,12 @@
"$ref": "#/definitions/gettableAlert"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"type": "array",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"x-go-name": "GettableAlerts",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/gettableAlerts"
},
"gettableSilence": {
@@ -5511,7 +5510,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"type": "object",
"required": [
"comment",
@@ -5552,6 +5550,8 @@
"x-go-name": "StartsAt"
}
},
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/postableSilence"
},
"receiver": {