-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(replay): Stop recording when hitting a rate limit #7018
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
d074416
to
4c2a170
Compare
@@ -64,120 +64,9 @@ describe('Integration | rate-limiting behaviour', () => { | |||
replay && replay.stop(); | |||
}); | |||
|
|||
it.each([ |
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.
IMO we don't need these tests anymore, as they only tested that we pause correctly for different rate limit timeouts we might receive from the Sentry backend. Just ensuring that we don't do anything after a 429 response should be good enough
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, makes sense! 👍 We could even move it to the general sendReplay
tests I guess?
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.
Generally I think it makes sense but given that we have this neat comment under the last test,
// NOTE: If you add a test after the last one, make sure to adjust the test setup
// As this ends with a `stopped()` replay, which may prevent future tests from working
// Sadly, fixing this turned out to be much more annoying than expected, so leaving this warning here for now
and that I ran exactly into this problem, wasting 30minutes trying fix it, I'd vote we leave it as is.
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.
ahh, right 🙈 damn we should fix those xD
size-limit report 📦
|
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.
Nice, saving some bytes!
l: We may want to move the tests to the general send replay tests, I guess we don't need a separate test module then. but this is super unimportant. Thanks for tackling this! 👍
One comment: I guess this should be |
We changed this [here](#7018), but apparently it is possible to have responses with a 200 status code but rate limit headers. This PR updates our handling to stop either for a non-200 status code, _or_ for a rate limit header. I also streamlined the tests for this a bit, we were testing a bunch of unrelated things, IMHO it's enough to test we stopped/didn't stop. Resolves: getsentry/sentry#49498
As discussed and outlined in #6984, we want to entirely stop recording the replay once we receive a 429 rate limit response. This PR gets rid of all the "pause on rate limit" logic. Because we already stop when we receive other http error responses, we can simply use this logic instead.
Note: feat() over ref() because it's a behaviour change, not because handling rate limits is entirely new (#6710)
closes #6984