Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Slack acknowledgment reminders #2769

Merged
merged 9 commits into from
Aug 11, 2023
Merged

Fix Slack acknowledgment reminders #2769

merged 9 commits into from
Aug 11, 2023

Conversation

vstpme
Copy link
Member

@vstpme vstpme commented Aug 9, 2023

What this PR does

Fixes a bug with Slack acknowledgment reminders not being sent (+ some refactoring and unit tests).

Which issue(s) this PR fixes

#2756

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@vstpme vstpme added the pr:no public docs Added to a PR that does not require public documentation updates label Aug 10, 2023
Comment on lines -333 to -335
# NOTE: we should probably migrate this field to models.UUIDField as it's ONLY ever being
# set to the result of uuid.uuid1
last_unique_unacknowledge_process_id: UUID | None = models.CharField(max_length=100, null=True, default=None)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last_unique_unacknowledge_process_id should be a string, so removing these type annotations and comments

@@ -1599,28 +1594,20 @@ def bulk_silence(user: User, alert_groups: "QuerySet[AlertGroup]", silence_delay
AlertGroup._bulk_silence(user, root_alert_groups_to_silence, silence_delay)
AlertGroup._bulk_silence(user, dependent_alert_groups_to_silence, silence_delay)

def start_ack_reminder(self, user: User):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user was only used for logging, so removing it from the args

if not countdown:
return

self.last_unique_unacknowledge_process_id = celery_uuid()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change of the PR: instead of using uuid1 to generate Celery task IDs, use celery.uuid.

The method stopped working after we upgraded to kombu 5.3.0 (a transitive dependency of celery). Previously, when UUID objects were passed to Celery tasks as arguments, they were converted to str and it was safe to compare it with strings. After upgrading to kombu 5.3.0, UUIDs are passed to tasks as UUID type, thus comparing them with strings always returns False.

@vstpme vstpme marked this pull request as ready for review August 10, 2023 16:06
@vstpme vstpme requested a review from a team August 10, 2023 16:06
Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstpme vstpme added this pull request to the merge queue Aug 11, 2023
Merged via the queue into dev with commit 6f0921a Aug 11, 2023
@vstpme vstpme deleted the vadimkerr/fix-ack-reminder branch August 11, 2023 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants