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

fix(project-release): POST should not call Snuba #69831

Merged
merged 1 commit into from Apr 29, 2024

Conversation

sentaur-athena
Copy link
Member

Customer is hitting rate limiting when they shouldn't. ticket: https://getsentry.atlassian.net/browse/OPS-5972
It turns out project release endpoint is intentionally skipping snuba on POST requests but this call is ignoring the passed flag no_snuba.

More context on investigation: https://sentry.slack.com/archives/C039ZGT5K/p1714161375978469

I'm not familiar with release code so leaving it here to see if this is the right behavior. Is it ok to set tag_values to empty at the time of release creation?

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 26, 2024
Copy link
Member

@vartec vartec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

src/sentry/api/serializers/models/release.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Apr 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.84%. Comparing base (d80487e) to head (545230f).
Report is 35 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #69831   +/-   ##
=======================================
  Coverage   79.84%   79.84%           
=======================================
  Files        6486     6486           
  Lines      288285   288315   +30     
  Branches    49667    49671    +4     
=======================================
+ Hits       230178   230202   +24     
- Misses      57705    57711    +6     
  Partials      402      402           
Files Coverage Δ
src/sentry/api/endpoints/project_releases.py 96.25% <100.00%> (ø)
src/sentry/api/serializers/models/release.py 95.65% <100.00%> (+0.03%) ⬆️

... and 40 files with indirect coverage changes

@vartec
Copy link
Member

vartec commented Apr 27, 2024

These will get None instead of a datetime, which might be fine. Given that it's using .get(key) instead of [key] I'd assume it's able do deal with None, but worth checking it that doesn't break anything in downstream (i.e. frontend).

"first_seen": first_seen.get(item.version),
"last_seen": last_seen.get(item.version),

Copy link
Member

@nhsiehgit nhsiehgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was no_snuba meant to be used more widely used than just the health data?
https://github.com/getsentry/sentry/pull/23568/files

I don't know if it's fair to say we're ignoring the flag as opposed to it was an added variable that we can utilize here 🤷

quick comment/question though

src/sentry/api/serializers/models/release.py Outdated Show resolved Hide resolved
src/sentry/api/serializers/models/release.py Show resolved Hide resolved
@sentaur-athena
Copy link
Member Author

Updated the PR so now the logic is that at the time of creation, first_seen and last_seen will be none. The type is already nullable so we should be find.

environment_id=None,
versions=[o.version for o in item_list],
)
if no_snuba_for_release_creation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why is snuba being called in a serializer? It doesn't make sense to me to have something that is supposed to serialize data make IO calls

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ good point 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave that decision to someone who has more context on release and merge this fix. @nhsiehgit would rotation backlog would be the right place to put this refactory ticket?

@sentaur-athena sentaur-athena merged commit 1c39139 into master Apr 29, 2024
49 checks passed
@sentaur-athena sentaur-athena deleted the athena/fix-release-rate-limiting branch April 29, 2024 18:57
Copy link

sentry-io bot commented May 8, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ SnubaError: result not available before execution deadline /api/0/organizations/{organization_slug}/releases/ View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants