-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(crons): Backfill new broken monitor setting #74415
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
Conversation
|
This PR has a migration; here is the generated SQL for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
bedd012 to
0c4c7dc
Compare
0c4c7dc to
80e475d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #74415 +/- ##
=======================================
Coverage 78.11% 78.12%
=======================================
Files 6676 6676
Lines 298721 298729 +8
Branches 51424 51427 +3
=======================================
+ Hits 233338 233374 +36
+ Misses 59095 59062 -33
- Partials 6288 6293 +5 |
src/sentry/migrations/0742_backfill_broken_monitor_notification_setting_option.py
Outdated
Show resolved
Hide resolved
| NotificationSettingOption.objects.get_or_create( | ||
| user_id=setting.user_id, | ||
| scope_type=setting.scope_type, | ||
| scope_identifier=setting.scope_identifier, | ||
| type="brokenMonitors", | ||
| defaults={"value": setting.value}, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to remove the approval type setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, the approval setting still exists and will control other classes of notifications, just wanted to split out broken monitor emails into its own category with this migration
| NotificationSettingOption.objects.create( | ||
| user_id=self.user3.id, | ||
| scope_type="user", | ||
| scope_identifier=self.user.id, | ||
| type="brokenMonitors", | ||
| value="never", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is an existing row for brokenMonitors does the value need to be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its very unlikely for there to be brokenMonitors rows unless a user has manually called the API at this point, but if they did choose to do that I just opt to respect the setting they chose, rather than overriding the value from their "approval" setting
80e475d to
15cd992
Compare
15cd992 to
cbd65bb
Compare
cbd65bb to
b2731d9
Compare
|
This PR has a migration; here is the generated SQL for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
b2731d9 to
0601459
Compare
0601459 to
40bffea
Compare
After #74415 is merged, let's go ahead and switch over to using the new notification setting.
Backfills the new broken monitor setting according to the previous value we were using which was from "Nudges" (
approval)