Add GraphQL query for alert integrations
What does this MR do?
Issue: #255515 (closed), partially #255603 (closed)
Adds a GraphQL query to expose alerting integrations. This query is intended to be used to populate the integrations table at project > Settings > Operations > Alerts.
The return type of the query is AlertManagementIntegration
, which can be either an AlertManagementHttpIntegration
or AlertManagementPrometheusIntegration
.
HTTP Integrations are backed by the AlertManagement::HttpIntegration
model. Prometheus Integrations are backed by a combination of ::PrometheusService
and ::Alerting::ProjectAlertingSetting
. For reference on the attributes exposed for prometheus integrations today, see OperationsHelper
.
Sample usage
query integrations {
project(fullPath: "root/autodevops") {
alertManagementIntegrations {
nodes {
id
type
active
name
url
token
apiUrl
}
}
}
}
Sample output
{
"data": {
"project": {
"alertManagementIntegrations": {
"nodes": [
{
"id": "gid://gitlab/AlertManagement::HttpIntegration/7",
"type": "HTTP",
"active": true,
"name": "test",
"url": "http://192.168.1.152:3000/root/autodevops/alerts/notify/test/eddd36969b2d3d6a.json",
"token": "7eb24af194116411ec8d66b58c6b0d2e",
"apiUrl": null
},
{
"id": "gid://gitlab/AlertManagement::HttpIntegration/6",
"type": "HTTP",
"active": false,
"name": "test",
"url": "http://192.168.1.152:3000/root/autodevops/alerts/notify/test/abce123.json",
"token": "8639e0ce06c731b00ee3e8dcdfd14fe0",
"apiUrl": null
},
{
"id": "gid://gitlab/AlertManagement::HttpIntegration/5",
"type": "HTTP",
"active": false,
"name": "test",
"url": "http://192.168.1.152:3000/root/autodevops/alerts/notify/test/bcd64c85f918a2e2.json",
"token": "5c8101533d970a55d5c105f8abff2192",
"apiUrl": null
},
{
"id": "gid://gitlab/PrometheusService/12",
"type": "PROMETHEUS",
"active": true,
"name": "Prometheus",
"url": "http://192.168.1.152:3000/root/autodevops/prometheus/alerts/notify.json",
"token": "0b18c37caa8fe980799b349916fe5ddf",
"apiUrl": "https://another-url-2.com"
}
]
}
}
}
}
Sibling MRs:
- Query: !45622 (merged)
- Create Mutation: !45842 (merged)
- Update/Reset token Mutations: !45844 (merged)
- Destroy Mutation: !45843 (merged) (HTTP integrations only)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team