Add GraphQL mutation to link alerts to incidents
What does this MR do and why?
Adds a GraphQL mutation to link alerts to incidents by providing alert references.
Contributes to #356057 (closed)
GraphQL mutation examples
Issue query
query Issue {
issue(id:"gid://gitlab/Issue/441") {
id
title
alertManagementAlerts {
nodes {
title
}
}
}
}
Response example
{
"data": {
"issue": {
"id": "gid://gitlab/Issue/441",
"title": "Testing linking alerts",
"alertManagementAlerts": {
"nodes": []
}
}
}
}
Mutation
mutation IssueLinkAlerts($input: IssueLinkAlertsInput!) {
issueLinkAlerts(input: $input) {
issue {
iid
alertManagementAlerts {
nodes {
iid
title
}
}
}
}
}
Query variables
{
"input":{
"projectPath": "ck3g/playground",
"iid": "4",
"alertReferences": ["^alert#1", "http://127.0.0.1:3000/ck3g/playground/-/alert_management/2/details"]
}
}
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Make sure to have developer (or above) permissions in your project
- Make sure to have alerts HTTP integration configured for your project under Settings > Monitor > Alerts
- Make sure to have existing alerts (they can be created from the integration settings)
- Navigate to GraphiQL explorer (for example http://127.0.0.1:3000/-/graphql-explorer)
- Use query and mutation from above with your project path, issue, and alert IDs.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vitali Tatarintev