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(crons): Write new monitor GUIDs to monitor slug #45258

Conversation

evanpurkhiser
Copy link
Member

For now slugs will simply match the GUIDs until we allow this to be API
configurable

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner March 1, 2023 20:05
@evanpurkhiser evanpurkhiser requested review from rjo100 and a team and removed request for a team March 1, 2023 20:05
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 1, 2023
@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Merging #45258 (e6cf4a3) into master (07621a7) will increase coverage by 0.01%.
The diff coverage is 100.00%.

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              
Impacted Files Coverage Δ
src/sentry/models/monitor.py 96.58% <100.00%> (+0.18%) ⬆️
src/sentry/utils/metrics.py 89.17% <0.00%> (-1.92%) ⬇️
src/sentry/utils/query.py 91.66% <0.00%> (+0.83%) ⬆️
src/sentry/testutils/cases.py 85.66% <0.00%> (+2.37%) ⬆️
src/sentry/new_migrations/monkey/executor.py 95.34% <0.00%> (+6.97%) ⬆️

# 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:
Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Member Author

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.

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-monitors-write-new-monitor-guids-to-monitor-slug branch from 6bce6ed to d2b6f06 Compare March 1, 2023 20:53
Comment on lines 161 to 163
rv = super().save(*args, **kwargs)

return rv
Copy link
Contributor

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

Copy link
Member Author

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 👍

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-monitors-write-new-monitor-guids-to-monitor-slug branch from d2b6f06 to e6cf4a3 Compare March 1, 2023 20:56
@evanpurkhiser evanpurkhiser merged commit b761568 into master Mar 1, 2023
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-monitors-write-new-monitor-guids-to-monitor-slug branch March 1, 2023 21:32
@evanpurkhiser evanpurkhiser changed the title feat(monitors): Write new monitor GUIDs to monitor slug feat(crons): Write new monitor GUIDs to monitor slug Mar 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants