feat(notifications): Instrument killswitch mechanism for notifications#114505
feat(notifications): Instrument killswitch mechanism for notifications#114505hobzcalvin merged 2 commits intomasterfrom
Conversation
| Even when the killswitch is added after the task is enqueued, the task | ||
| itself must short-circuit before sending. | ||
| """ | ||
| service = NotificationService(data=MockNotification(message="test")) |
There was a problem hiding this comment.
Iirc, tasks don't run by default, so you may be missing a with task_runner() decorator invocation to ensure we actually flush the attempted send. See:
It could help to have an assertion that validates that we step through at least some of the dispatch code.
Similarly, we don't need to enqueue the task manually in this case since the invocation is deferred already.
There was a problem hiding this comment.
with tasks() returns TaskRunner which returns the same callable:
sentry/src/sentry/testutils/cases.py
Line 237 in dca7d73
and I can confirm the test breaks /
alert() is called if the killswitch value doesn't match.
Adding assert that the killswitch log message fires, here and elsewhere.
notify_async is called in the test above; the enqueue is manual here to ensure that the killswitch inside notify_target_async also works:
There was a problem hiding this comment.
Totally missed that, change looks good!
While testing #114505 it was helpful to use e.g. `sentry notifications send email --source 'data-export-success'` without having an actual email backend set up. This turns the exception into a warning.
While testing #114505 it was helpful to use e.g. `sentry notifications send email --source 'data-export-success'` without having an actual email backend set up. This turns the exception into a warning.
#114505) resolves ISWF-2178 Adds `notifications.platform.killswitch.sources` option key which can be set in options automator with string values corresponding to notification sources we want to block sending. Blocks in `notify_target`, `notify_async`, and `notify_target_async`.
resolves ISWF-2178
Adds
notifications.platform.killswitch.sourcesoption key which can be set in options automator with string values corresponding to notification sources we want to block sending. Blocks innotify_target,notify_async, andnotify_target_async.