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: Send email notifications on failure #21609

Merged
merged 7 commits into from
Apr 19, 2024

Conversation

tomasfarias
Copy link
Contributor

@tomasfarias tomasfarias commented Apr 17, 2024

Problem

Users are not being properly notified when something goes wrong with their batch exports. This is particularly relevant for NonRetryableErrors which require user input to fix (e.g. wrong credentials).

Changes

Send an email notification when a batch export fails. This is done on a best effort basis, as I don't want to continuously fail if something goes wrong with the email sending.

NOTE: These are capped at one email per day per batch export to avoid spam. We achieve this by including the date component in the campaign key.

Here's how the email looks while testing locally:
Screenshot 2024-04-16 at 17-48-14 MailDev

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

If self-hosted has an email server configured, should work too.

How did you test this code?

Added unit tests.

@tomasfarias tomasfarias requested a review from a team April 17, 2024 14:31
@tomasfarias tomasfarias force-pushed the feat/batch-exports-email-notification-on-failure branch from c0140cb to abb196a Compare April 17, 2024 14:35
@tomasfarias tomasfarias force-pushed the feat/batch-exports-email-notification-on-failure branch from cce390e to a707e4f Compare April 18, 2024 15:24
@tomasfarias tomasfarias force-pushed the feat/batch-exports-email-notification-on-failure branch from a707e4f to 69b9b14 Compare April 18, 2024 15:48
* feat: Pause batch export on reaching failure threshold

* fix: Pause only on non-retryable failures

* refactor: Raise an exception on invalid check_window / failure_threshold
@tomasfarias tomasfarias enabled auto-merge (squash) April 19, 2024 09:05
@tomasfarias tomasfarias merged commit dd4a968 into master Apr 19, 2024
98 checks passed
@tomasfarias tomasfarias deleted the feat/batch-exports-email-notification-on-failure branch April 19, 2024 09:31
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.

2 participants