Skip to content

Conversation

@jennafauconnier
Copy link
Contributor

@jennafauconnier jennafauconnier commented Jul 24, 2024

Implement Postmortem Reminder Notifications in Slack

Description

This pull request introduces a feature that sends reminder messages for incidents requiring postmortem updates in Slack. It ensures that reminders are sent to the commanders and the appropriate channels based on the incident's status and the time since the last update.

Changes Made

  • - Added functionality to check for open incidents that are not resolved (i.e., those with _status values between FIXED and CLOSED).
  • - Implemented logic to check if reminders have been sent:
    - If a reminder to the commander was sent more than two days ago and no channel message exists, a new reminder will be sent to the incident's channel.
    - If no reminder has ever been sent to the commander and the last incident update was over two days ago, a direct reminder will be sent to the commander.
  • - Optimized database queries for fetching incidents and their related roles.

Motivation and Context

  • These changes are important as they improve communication and efficiency in incident management. By sending timely reminders, we ensure that incidents are addressed appropriately and that commanders are kept informed of their responsibilities. Being more efficient on post mortem management.

How to Test

  1. Trigger the send_postmortem_late_reminder task in your environment (use ff-manage task <name_of_task>).
  2. Ensure that there are open incidents that meet the criteria for sending reminders (i.e., not resolved, priority is 5 or less).
  3. Verify that reminders are sent based on the following rules:
    A reminder is sent to the incident's channel if the last reminder to the commander was sent more than two days ago.
    A direct reminder is sent to the commander if no reminder has ever been sent and the last incident update was over two days ago.
  4. Check the logs for any errors or exceptions to ensure that the functionality works as intended.

Checklist

  • I have tested my changes
  • My code follows the style guidelines of this project

@jennafauconnier jennafauconnier requested a review from GabDug July 24, 2024 14:52
@jennafauconnier jennafauconnier self-assigned this Jul 24, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 29.85075% with 47 lines in your changes missing coverage. Please review.

Project coverage is 62.55%. Comparing base (60a7836) to head (68acc72).

Files with missing lines Patch % Lines
src/firefighter/slack/tasks/send_reminders.py 24.13% 22 Missing ⚠️
src/firefighter/slack/messages/slack_messages.py 45.45% 12 Missing ⚠️
src/firefighter/slack/tasks/reminder_postmortem.py 11.11% 8 Missing ⚠️
src/firefighter/slack/models/user.py 28.57% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
- Coverage   62.83%   62.55%   -0.29%     
==========================================
  Files         215      216       +1     
  Lines        9587     9677      +90     
  Branches     1289     1305      +16     
==========================================
+ Hits         6024     6053      +29     
- Misses       3354     3415      +61     
  Partials      209      209              
Flag Coverage Δ
unittests 62.55% <29.85%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GabDug GabDug force-pushed the feature/tag-incident-commander branch from bca3de7 to 3829cb3 Compare July 25, 2024 08:08
@jennafauconnier jennafauconnier changed the title add logic for reminder postmortem Add reminder on postmortem incident Jul 25, 2024
@jennafauconnier jennafauconnier changed the title Add reminder on postmortem incident feat(slack): add reminder on postmortem incident Oct 29, 2024
@jennafauconnier jennafauconnier force-pushed the feature/tag-incident-commander branch from 7fade0b to 68acc72 Compare October 29, 2024 13:42
@NicolasLafitteMM
Copy link
Collaborator

/rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants