You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(core): Do not run setup for integration on client multiple times
Currently, if you do:
```js
const myIntegration = new InboundFilters();
const myIntegration2 = new InboundFilters();
const myIntegration3 = new InboundFilters();
client.addIntegration(myIntegration);
client.addIntegration(myIntegration2);
client.addIntegration(myIntegration3);
```
All of these will have their `setup` hooks called, and thus they will be initialized multiple times. However, all but the last will be discarded from the client and not be accessible anymore via e.g. `getIntegration()` or similar.
This used to not matter because everything was guarded through `setupOnce()` anyhow, but i would say this is more of a bug and not really expected.
With this change, an integration can only be added to a client once, if you try to add it again it will noop.
Copy file name to clipboardExpand all lines: MIGRATION.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,11 @@ npx @sentry/migr8@latest
8
8
9
9
This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!
10
10
11
+
## Deprecate `client.setupIntegrations()`
12
+
13
+
Instead, use the new `client.init()` method. You should probably not use this directly and instead use `Sentry.init()`, which calls this under the hood. But if you have a special use case that requires that, you can call `client.init()` instead now.
14
+
Note that this has a bit of a different semantic, as it does not check anymore if the SDK is enabled - it will install the integrations anyhow. You need to check if you want to initialize the client yourself.
15
+
11
16
## Deprecate `scope.setTransactionName()`
12
17
13
18
Instead, either set this as attributes or tags, or use an event processor to set `event.transaction`.
0 commit comments