Alerting: modify alertmanager endpoints for proxying using the datasource UID (#47978)

* Alerting: enable proxying alertmanager calls using the datasource UID

* Remove use of datasource ID from the API

* Update frontend
This commit is contained in:
Sofia Papagiannaki
2022-04-29 10:25:22 +03:00
committed by GitHub
parent 49491bc73e
commit 3e752a0db1
14 changed files with 360 additions and 356 deletions
+61 -75
View File
@@ -465,7 +465,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/api/v2/alerts": {
"/api/alertmanager/{DatasourceUID}/api/v2/alerts": {
"get": {
"description": "get alertmanager alerts",
"tags": [
@@ -515,10 +515,9 @@
"in": "query"
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -556,10 +555,9 @@
}
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -580,7 +578,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/api/v2/alerts/groups": {
"/api/alertmanager/{DatasourceUID}/api/v2/alerts/groups": {
"get": {
"description": "get alertmanager alerts",
"tags": [
@@ -630,10 +628,9 @@
"in": "query"
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -654,7 +651,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}": {
"/api/alertmanager/{DatasourceUID}/api/v2/silence/{SilenceId}": {
"get": {
"description": "get silence",
"tags": [
@@ -669,10 +666,9 @@
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -706,10 +702,9 @@
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -730,7 +725,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/api/v2/silences": {
"/api/alertmanager/{DatasourceUID}/api/v2/silences": {
"get": {
"description": "get silences",
"tags": [
@@ -748,10 +743,9 @@
"in": "query"
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -786,10 +780,9 @@
}
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -810,7 +803,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/api/v2/status": {
"/api/alertmanager/{DatasourceUID}/api/v2/status": {
"get": {
"description": "get alertmanager status and configuration",
"tags": [
@@ -819,10 +812,9 @@
"operationId": "RouteGetAMStatus",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -843,7 +835,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/config/api/v1/alerts": {
"/api/alertmanager/{DatasourceUID}/config/api/v1/alerts": {
"get": {
"description": "gets an Alerting config",
"tags": [
@@ -852,10 +844,9 @@
"operationId": "RouteGetAlertingConfig",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -890,10 +881,9 @@
}
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -921,10 +911,9 @@
"operationId": "RouteDeleteAlertingConfig",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -945,7 +934,7 @@
}
}
},
"/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test": {
"/api/alertmanager/{DatasourceUID}/config/api/v1/receivers/test": {
"post": {
"tags": [
"alertmanager"
@@ -961,10 +950,9 @@
}
},
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"name": "DatasourceID",
"type": "string",
"description": "DatasoureUID should be the datasource UID identifier",
"name": "DatasourceUID",
"in": "path",
"required": true
}
@@ -1093,7 +1081,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1120,7 +1108,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1527,7 +1515,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1568,7 +1556,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1603,7 +1591,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1641,7 +1629,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1677,7 +1665,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1714,7 +1702,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -1932,7 +1920,7 @@
{
"type": "integer",
"format": "int64",
"description": "DatasourceID should be the numeric datasource id",
"description": "DatasourceID should be the numeric datasource identifier",
"name": "DatasourceID",
"in": "path",
"required": true
@@ -2551,7 +2539,7 @@
"type": "string",
"x-go-name": "Name"
},
"provanance": {
"provenance": {
"type": "string",
"x-go-name": "Provenance"
},
@@ -2839,6 +2827,9 @@
"type": "string",
"x-go-name": "Name"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"secureFields": {
"type": "object",
"additionalProperties": {
@@ -5057,6 +5048,7 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": [
"alerts",
@@ -5079,17 +5071,14 @@
"$ref": "#/definitions/receiver"
}
},
"x-go-name": "AlertGroup",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/alertGroup"
},
"alertGroups": {
"description": "AlertGroups alert groups",
"type": "array",
"items": {
"$ref": "#/definitions/alertGroup"
},
"x-go-name": "AlertGroups",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/alertGroups"
},
"alertStatus": {
@@ -5281,6 +5270,7 @@
"$ref": "#/definitions/gettableAlerts"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"type": "object",
"required": [
"comment",
@@ -5333,17 +5323,14 @@
"x-go-name": "UpdatedAt"
}
},
"x-go-name": "GettableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/gettableSilence"
},
"gettableSilences": {
"description": "GettableSilences gettable silences",
"type": "array",
"items": {
"$ref": "#/definitions/gettableSilence"
},
"x-go-name": "GettableSilences",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/gettableSilences"
},
"labelSet": {
@@ -5473,6 +5460,7 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"type": "object",
"required": [
"comment",
@@ -5513,8 +5501,6 @@
"x-go-name": "StartsAt"
}
},
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/postableSilence"
},
"receiver": {