-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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(crons): Write new monitor GUIDs to monitor slug #45258
feat(crons): Write new monitor GUIDs to monitor slug #45258
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #45258 +/- ##
==========================================
+ Coverage 80.21% 80.23% +0.01%
==========================================
Files 4725 4725
Lines 198809 198815 +6
Branches 12022 12022
==========================================
+ Hits 159480 159512 +32
+ Misses 39067 39041 -26
Partials 262 262
|
# NOTE: We ONLY set a slug while saving when creating a new monitor and | ||
# the slug has not been set. Otherwise existing monitors without slugs | ||
# would have their guids changed | ||
if self._state.adding is True and self.slug is None: |
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.
since this is temporary, OK to use this hack
# the slug has not been set. Otherwise existing monitors without slugs | ||
# would have their guids changed | ||
if self._state.adding is True and self.slug is None: | ||
self.guid = uuid4() |
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.
we have to generate a guid
here because auto_add
doesn't create it until later, right?
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.
Yes correct, unfortunately that happens in the super save call.
6bce6ed
to
d2b6f06
Compare
src/sentry/models/monitor.py
Outdated
rv = super().save(*args, **kwargs) | ||
|
||
return rv |
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.
could also just return this without the variable
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.
good catch, I think I copied this somewhere 👍
d2b6f06
to
e6cf4a3
Compare
For now slugs will simply match the GUIDs until we allow this to be API
configurable