@@ -10,6 +10,51 @@ npx @sentry/migr8@latest
1010This will let you select which updates to run, and automatically update your code. Make sure to still review all code
1111changes!
1212
13+ ## Deprecate ` Hub `
14+
15+ The ` Hub ` has been a very important part of the Sentry SDK API up until now. Hubs were the SDK's "unit of concurrency"
16+ to keep track of data across threads and to scope data to certain parts of your code. Because it is overly complicated
17+ and confusing to power users, it is going to be replaced by a set of new APIs: the "new Scope API".
18+
19+ ` Scope ` s have existed before in the SDK but we are now expanding on them because we have found them powerful enough to
20+ fully cover the ` Hub ` API.
21+
22+ If you are using the ` Hub ` right now, see the following table on how to migrate to the new API:
23+
24+ | Old ` Hub ` API | New ` Scope ` API |
25+ | ---------------------- | ------------------------------------------------------------------------------------ |
26+ | ` new Hub() ` | ` withScope() ` , ` withIsolationScope() ` or ` new Scope() ` |
27+ | hub.isOlderThan() | REMOVED - Was used to compare ` Hub ` instances, which are gonna be removed |
28+ | hub.bindClient() | A combination of ` scope.setClient() ` and ` client.setupIntegrations() ` |
29+ | hub.pushScope() | ` Sentry.withScope() ` |
30+ | hub.popScope() | ` Sentry.withScope() ` |
31+ | hub.withScope() | ` Sentry.withScope() ` |
32+ | getClient() | ` Sentry.getClient() ` |
33+ | getScope() | ` Sentry.getCurrentScope() ` to get the currently active scope |
34+ | getIsolationScope() | ` Sentry.getIsolationScope() ` |
35+ | getStack() | REMOVED - The stack used to hold scopes. Scopes are used directly now |
36+ | getStackTop() | REMOVED - The stack used to hold scopes. Scopes are used directly now |
37+ | captureException() | ` Sentry.captureException() ` |
38+ | captureMessage() | ` Sentry.captureMessage() ` |
39+ | captureEvent() | ` Sentry.captureEvent() ` |
40+ | lastEventId() | REMOVED - Use event processors or beforeSend instead |
41+ | addBreadcrumb() | ` Sentry.addBreadcrumb() ` |
42+ | setUser() | ` Sentry.setUser() ` |
43+ | setTags() | ` Sentry.setTags() ` |
44+ | setExtras() | ` Sentry.setExtras() ` |
45+ | setTag() | ` Sentry.setTag() ` |
46+ | setExtra() | ` Sentry.setExtra() ` |
47+ | setContext() | ` Sentry.setContext() ` |
48+ | configureScope() | REMOVED - Scopes are now the unit of concurrency |
49+ | run() | ` Sentry.withScope() ` or ` Sentry.withIsolationScope() ` |
50+ | getIntegration() | ` client.getIntegration() ` |
51+ | startTransaction() | ` Sentry.startSpan() ` , ` Sentry.startInactiveSpan() ` or ` Sentry.startSpanManual() ` |
52+ | traceHeaders() | REMOVED - The closest equivalent is now ` spanToTraceHeader(getActiveSpan()) ` |
53+ | captureSession() | ` Sentry.captureSession() ` |
54+ | startSession() | ` Sentry.startSession() ` |
55+ | endSession() | ` Sentry.endSession() ` |
56+ | shouldSendDefaultPii() | REMOVED - The closest equivalent is ` Sentry.getClient().getOptions().sendDefaultPii ` |
57+
1358## Deprecate ` scope.getSpan() ` and ` scope.setSpan() `
1459
1560Instead, you can get the currently active span via ` Sentry.getActiveSpan() ` . Setting a span on the scope happens
@@ -76,17 +121,6 @@ Sentry.init({
76121});
77122```
78123
79- ## Deprecated fields on ` Hub `
80-
81- In v8, the Hub class will be removed. The following methods are therefore deprecated:
82-
83- - ` hub.startTransaction() ` : See [ Deprecation of ` startTransaction ` ] ( #deprecate-starttransaction )
84- - ` hub.lastEventId() ` : See [ Deprecation of ` lastEventId ` ] ( #deprecate-sentrylasteventid-and-hublasteventid )
85- - ` hub.startSession() ` : Use top-level ` Sentry.startSession() ` instead
86- - ` hub.endSession() ` : Use top-level ` Sentry.endSession() ` instead
87- - ` hub.captureSession() ` : Use top-level ` Sentry.captureSession() ` instead
88- - ` hub.shouldSendDefaultPii() ` : Access Sentry client option via ` Sentry.getClient().getOptions().sendDefaultPii ` instead
89-
90124## Deprecated fields on ` Span ` and ` Transaction `
91125
92126In v8, the Span class is heavily reworked. The following properties & methods are thus deprecated:
0 commit comments