@@ -8,6 +8,50 @@ 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 ` Hub `
12
+
13
+ The ` Hub ` has been a very important part of the Sentry SDK API up until now.
14
+ Hubs were the SDKs "unit of concurrency" to keep track of data across threads and to scope data to certain parts of your code.
15
+ Because it is overly complicated and confusing to power users, it is going to be replaced by a set of new APIs: the "new Scope API".
16
+
17
+ ` Scope ` s have existed before in the SDK but we are now expanding on them because we have found them powerful enough to fully cover the ` Hub ` API.
18
+
19
+ If you are using the ` Hub ` right now, see the following table on how to migrate to the new API:
20
+
21
+ | Old ` Hub ` API | New ` Scope ` API |
22
+ | --- | --- |
23
+ | ` new Hub() ` | ` withScope() ` , ` withIsolationScope() ` or ` new Scope() ` |
24
+ | hub.isOlderThan() | REMOVED - Was used to compare ` Hub ` instances, which are gonna be removed. |
25
+ | hub.bindClient() | A combination of ` scope.setClient() ` and ` client.setupIntegrations() ` |
26
+ | hub.pushScope() | Best replaced with ` withScope() ` |
27
+ | hub.popScope() | When used in combination with ` hub.pushScope() ` best replaced with ` withScope() ` |
28
+ | hub.withScope() | ` withScope() ` |
29
+ | getClient() | ` scope.getClient ` |
30
+ | getScope() | REMOVED - Scopes are used directly now. |
31
+ | getIsolationScope() | ` Sentry.getIsolationScope() ` |
32
+ | getStack() | REMOVED - The stack used to hold scopes. Scopes are used directly now. |
33
+ | getStackTop() | REMOVED - The stack used to hold scopes. Scopes are used directly now. |
34
+ | captureException() | ` scope.captureException() ` |
35
+ | captureMessage() | ` scope.captureMessage() ` |
36
+ | captureEvent() | ` scope.captureEvent() ` |
37
+ | lastEventId() | REMOVED - Use event processors or beforeSend instead. |
38
+ | addBreadcrumb() | ` scope.addBreadcrumb() ` |
39
+ | setUser() | ` scope.setUser() ` |
40
+ | setTags() | ` scope.setTags() ` |
41
+ | setExtras() | ` scope.setExtras() ` |
42
+ | setTag() | ` scope.setTag() ` |
43
+ | setExtra() | ` scope.setExtra() ` |
44
+ | setContext() | ` scope.setContext() ` |
45
+ | configureScope() | REMOVED - Scopes are now the unit of concurrency. |
46
+ | run() | ` withScope() ` or ` withIsolationScope() ` |
47
+ | getIntegration() | ` client.getIntegration() ` |
48
+ | startTransaction() | ` startSpan() ` , ` startInactiveSpan() ` or ` startSpanManual() ` |
49
+ | traceHeaders() | REMOVED - The closest equivalent is now ` spanToTraceHeader(getActiveSpan()) ` |
50
+ | captureSession() | Use top level ` Sentry.captureSession() ` |
51
+ | startSession() | Top level ` Sentry.startSession() ` |
52
+ | endSession() | Top level ` Sentry.endSession() ` |
53
+ | shouldSendDefaultPii() | REMOVED - The closest equivalent is ` scope.getClient().getOptions().sendDefaultPii ` |
54
+
11
55
## Deprecate ` scope.getSpan() ` and ` scope.setSpan() `
12
56
13
57
Instead, you can get the currently active span via ` Sentry.getActiveSpan() ` .
0 commit comments