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(scope): Add client to scope #3768

Closed
wants to merge 1 commit into from
Closed

Conversation

AbhiPrasad
Copy link
Member

Ref: #3751

As we move toward introducing a scope manager, we want to remove the idea of a stack of scopes and clients. As a replacement, the client now goes onto the scope. This enables patterns like:

Sentry.withScope((scope) => {
  scope.bindClient(TeamAClient);
  // any operations will use team A's client
});

By propagating the client through the scope, it becomes easier to devs to leverage multiple clients on the same page or process. This does mean that to capture events and messages, the hub will have to reach into the scope to access the client.

Temporarily, we store the client reference in both the hub stack and in the scope. This is to have backwards compatibility while we talk through the patterns and edit tests.

@github-actions
Copy link
Contributor

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 21.42 KB (+0.13% 🔺)
@sentry/browser - Webpack 22.44 KB (+0.15% 🔺)
@sentry/react - Webpack 22.47 KB (+0.15% 🔺)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.91 KB (+0.1% 🔺)

@rhcarvalho
Copy link
Contributor

@AbhiPrasad let's sync once more (on Monday) before we merge this.
As with #3753, I have a hunch we could limit the risk and number of changes by concentrating on better hub propagation (and leave the scope-centered idea to a major release).

@AbhiPrasad
Copy link
Member Author

Closing as we have decided not to pursue this for now.

@AbhiPrasad AbhiPrasad closed this Jul 12, 2021
@AbhiPrasad AbhiPrasad deleted the abhi-client-on-scope branch July 12, 2021 10:58
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.

3 participants