Skip to content

Add mutation for setting escalation policy on incidents

What does this MR do and why?

This MR:

  • Creates pending escalations for incidents when relevant policy or status updates occur
  • Moves helpers for "open" statuses from AlertManagement::Alert into Escalatable module
  • Adds sidekiq processing for issue escalations following same flow as for PendingEscalation::Alert

Overall flow:

There are a number of steps to updates to IncidentManagement::IssuableEscalationStatus records. These steps roughly follow the flowchart below. The area circled in red is the scope of this MR.

Screen_Shot_2021-12-16_at_7.38.36_PM

Sample inputs/outputs

Fetch
query issues {
  project(fullPath: "root/autodevops") {
    issues(types: INCIDENT) {
      nodes {
        iid
        title
        type
        escalationPolicy {
          id
	  name
        }
      }
    }
  }
}
{
  "data": {
    "project": {
      "issues": {
        "nodes": [
          {
            "iid": "194",
            "title": "trying again on new alert  - queue another",
            "type": "INCIDENT",
            "escalationPolicy": {
              "id": "gid://gitlab/IncidentManagement::EscalationPolicy/220",
              "name": "Testing"
            }
          },
          {
            "iid": "193",
            "title": "trying again on new alert  - queue another",
            "type": "INCIDENT",
            "escalationPolicy": null
          },
          {
            "iid": "192",
            "title": "trying again on new alert  - queue another",
            "type": "INCIDENT",
            "escalationPolicy": null
          }
        ]
      }
    }
  }
}
Update
mutation SetEscalationPolicy($update: IssueSetEscalationPolicyInput!) {
  issueSetEscalationPolicy(input: $update) {
    issue {
      iid
      title
      type
      escalationPolicy {
        id
        name
      }
    }
  }
}

Unsetting the policy

{
  "update": {
    "projectPath": "root/autodevops",
    "iid": "194",
    "escalationPolicyId": null
  }
}
{
  "data": {
    "issueSetEscalationPolicy": {
      "issue": {
        "iid": "194",
        "title": "trying again on new alert  - queue another",
        "type": "INCIDENT",
        "escalationPolicy": null
      }
    }
  }
}

Setting the policy

{
  "update": {
    "projectPath": "root/autodevops",
    "iid": "194",
    "escalationPolicyId": "gid://gitlab/IncidentManagement::EscalationPolicy/220"
  }
}
{
  "data": {
    "issueSetEscalationPolicy": {
      "issue": {
        "iid": "194",
        "title": "trying again on new alert  - queue another",
        "type": "INCIDENT",
        "escalationPolicy": {
          "id": "gid://gitlab/IncidentManagement::EscalationPolicy/220",
          "name": "Testing"
        }
      }
    }
  }
}

How to set up and validate locally

  1. Follow the steps in !76819 (merged) add an IncidentManagement::IssuableEscalationStatus association to your incident
  2. Open /-/graphql-explorer in your local env to run graphql queries/mutations like the samples above

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah Yasonik

Merge request reports

Loading