Skip to content

Add system note when escalation status changes

What does this MR do and why?

Creates a system note when the escalation status of an incident changes. !77058 (merged) includes behavior to sync the status between an incident and a corresponding alert (if preset). If the incident status is changed as a result of an alert's status being changed, this reason is included in the status (and vice versa).

Context

  • New Issues with an issue_type of :incident will have one associated IncidentManagement::IssuableEscalationStatus. It is accessible via incident.escalation_status
  • IncidentManagement::IssuableEscalationStatus records have a status field, which is the subject of this system note. From a user perspective, the Status field will be directly on the incident. (See #330283 (closed)).

Screenshots or screen recordings

Actions resulting in system note screenshots below:

  1. Create alert
  2. Create associated incident
  3. Acknowledge alert (via UI)
  4. Resolve incident (via console, per instructions below)
Alert system notes incident system notes
Screen_Shot_2022-01-13_at_5.35.23_PM Screen_Shot_2022-01-13_at_5.35.29_PM

How to set up and validate locally

  1. Enable the feature flag via rails console

    Feature.enable(:incident_escalations)

System note for status changes on manually created incident

  1. Create an incident (Issue w/ issue_type of :incident) via UI
  2. Access the corresponding records via console
    incident = Issue.where(issue_type: 1).last 
    project = incident.project
    user = project.owner # or whatever user has developer+ permissions on the project
  3. Run ::Issues::UpdateService.new(project: project, current_user: user, params: { escalation_status: { status: :resolved } }).execute(incident) to change the status & create the system note on the incident

System note for status changes incident created from alert

  1. Create an HTTP alert integration for your project
  2. Create a test alert for your integration
    • sample payload: {"title":"This is a new alert!"}
  3. Find your alert under Monitor > Alerts, click to view, and create an issue from the alert
  4. You can change the status of the alert via UI & see the system notes on both the alert & incident
  5. To change the incident status, see the previous section 'System note for status changes on manually created incident' for instructions via rails console

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