-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Exponential backoff if Sentry server returns 429 #839
Conversation
Should there be a max duration, e.g. 2 minutes or something? |
|
||
_send: function(data) { | ||
if (this._shouldBackoff()) { | ||
return; |
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.
I'd suggest that we console.log
or something that this is happening. That way we're not dropping things in the dark without any insight as to why if someone were to debug. Including ourselves.
imo we can do similar, if not the same behavior for a few different status codes. Not just 429. We have cases of someone revoking a DSN, in which case SDKs will continue to spam the old key. Or the project is deleted entirely, with code still out in production continuing to spam. In theory, we could be more aggressive about these errors and just 100% shut down the SDK, but that might just be more complexity in code base.
And on that note, I'm pretty sure raven-js now can be re-configured at runtime to change the DSN. If so, I think this reconfiguring should reset this backoff and start fresh. Since a new DSN likely would have a different outcome. Just my thoughts on this. :) |
XHR requests need this to be able to read our debug headers See: getsentry/sentry-javascript#839
retry = parseInt(retry, 10); | ||
} catch (e) { | ||
/* eslint no-empty:0 */ | ||
} |
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.
X-Sentry-Error
was added too, so you can attempt to fetch this and expose this as a "reason" for debugging and logging.
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.
What typically appears there?
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.
The actual reason.
So an example string would be like:
Invalid project_id: 10
or
Invalid api key
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.
Okay. That could be useful for completely different reasons.
(Does Retry-After say something about rate limiting? Or completely independent?)
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.
(Does Retry-After say something about rate limiting? Or completely independent?)
This is only related to rate limiting and won't exist on any other response as of today.
XHR requests need this to be able to read our debug headers See: getsentry/sentry-javascript#839
I moved the back off check to run after filters have run ... because, if you were going to filter out an error anyways (e.g. |
c7e0d9b
to
fffb7d9
Compare
@mattrobenolt – can you look at this again? I think I've addressed all your feedback (except |
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.
Looks good to me, but someone who knows js better than me should give final approval.
retry = parseInt(retry, 10); | ||
} catch (e) { | ||
/* eslint no-empty:0 */ | ||
} |
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.
(Does Retry-After say something about rate limiting? Or completely independent?)
This is only related to rate limiting and won't exist on any other response as of today.
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.
looks great
I'm going to look at this PR in about 3 years and be very glad we did this. Thanks <3 |
cc @MaxBittker @LewisJEllis @mattrobenolt @JTCunning