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: Implement X-Sentry-Rate-Limits handling for browser SDK transports #2962

Merged
merged 4 commits into from
Oct 12, 2020

Conversation

kamilogorek
Copy link
Contributor

No description provided.

@kamilogorek kamilogorek requested a review from a team October 8, 2020 14:26
@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2020

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 18.35 KB (+1.82% 🔺)
@sentry/browser - Webpack 19.17 KB (+1.77% 🔺)
@sentry/react - Webpack 19.17 KB (+1.77% 🔺)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 24.96 KB (+1.19% 🔺)

Copy link
Contributor

@rhcarvalho rhcarvalho left a comment

Choose a reason for hiding this comment

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

One of the aspects of the X-Sentry-Rate-Limits is that it may come in any response status, not only 429 😮

packages/browser/src/transports/base.ts Outdated Show resolved Hide resolved
packages/browser/src/transports/base.ts Outdated Show resolved Hide resolved
packages/browser/src/transports/base.ts Outdated Show resolved Hide resolved
packages/browser/src/transports/base.ts Outdated Show resolved Hide resolved
packages/browser/src/transports/fetch.ts Outdated Show resolved Hide resolved
packages/browser/src/transports/xhr.ts Outdated Show resolved Hide resolved
Comment on lines +143 to +157
// 1st event - _isRateLimited - false
.onCall(0)
.returns(beforeLimit)
// 1st event - _handleRateLimit
.onCall(1)
.returns(beforeLimit)
// 2nd event - _isRateLimited - true
.onCall(2)
.returns(withinLimit)
// 3rd event - _isRateLimited - false
.onCall(3)
.returns(afterLimit)
// 3rd event - _handleRateLimit
.onCall(4)
.returns(afterLimit);
Copy link
Contributor

Choose a reason for hiding this comment

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

L:

This is rather confusing 😕

@kamilogorek kamilogorek merged commit 8601648 into master Oct 12, 2020
@kamilogorek kamilogorek deleted the rate-limits branch October 12, 2020 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants