getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8k stars 1.58k forks source link

[Feature Flags] Support multi-client configs for browser SDKs #14281

Open aliu39 opened 3 days ago

aliu39 commented 3 days ago

Description

https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/ The browser may have >1 Sentry client per SDK instance. The most common case seems to be browser extensions. We could support this case by isolating flags from different clients, maintaining a WeakMap of <Client, flag evaluations>.

mydea commented 2 days ago

Just some thoughts, generally in such scenarios we do not support global things very well overall. There are a lot of integrations etc. that do not work in such global settings (meaning, they only work for the "main" global app, but not e.g. the browser extension), and it can be a reasonable solution to say that a certain feature is not fully supported in e.g. a browser extension. Not saying this is what we should do, just wanted to point out that sometimes it is simply not really doable well, sadly, so we don't always have a choice :(