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

feat(notifications): adds task for slack notifications #29720

Merged
merged 5 commits into from
Nov 11, 2021

Conversation

scefali
Copy link
Contributor

@scefali scefali commented Nov 2, 2021

This PR creates a thin wrapper around Slack's postMessage endpoint and turns it into a task. We are currently using this task for the notification platform so that we won't have to make users wait for Slack messages to send before we end the web request that triggered the notification (if there is one). This is important for the upcoming "Request to X" notifications.

Note that I purposely made the task have 0 retries. In the future, we might want to add logic to retry 429 errors and timeouts but I am going to leave it to the Ecosystem team to figure out how to tune it.

@mgaeta
Copy link
Contributor

mgaeta commented Nov 3, 2021

We were discussing this problem on Ecosystems yesterday and decided that we should have per-workspace redis queues that can fire off API calls at 1 message per second. Enqueuing would be async so you get your endpoint speed-up.

@scefali
Copy link
Contributor Author

scefali commented Nov 3, 2021

We were discussing this problem on Ecosystems yesterday and decided that we should have per-workspace redis queues that can fire off API calls at 1 message per second. Enqueuing would be async so you get your endpoint speed-up.

@mgaeta Ok...so I should close this PR? When do you think you can build that out?



# TODO: add retry logic
@instrumented_task(name="sentry.integrations.slack.post_message", queue="integrations", max_retries=0) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

Do you also want late_acks? That will ensure that your messages are retried if a worker is restarted in while this task is running.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@markstory At this point, this task just exists so we can make it async. We'll have to follow up later with handling failures. That's why I set max_retries to 0.

@scefali scefali merged commit 45b446e into master Nov 11, 2021
@scefali scefali deleted the feat/slack-notification-task branch November 11, 2021 17:29
scefali pushed a commit that referenced this pull request Nov 11, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants