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
Copy file name to clipboardExpand all lines: docs/platforms/python/migration/1.x-to-2.x.mdx
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ The old APIs will continue to work in 2.0, but we recommend migrating to their n
67
67
68
68
### Activating a Custom Hub
69
69
70
-
If you were using a custom hub to isolate event data, we recommend using a custom isolation scope instead. To activate the custom isolation scope, you will need to explicitly pass the isolation scope to the `use_isolation_scope`, which creates a context manager that activates the scope. Here is an example of how to change your code to make it work:
70
+
If you were using a custom hub to isolate event data, we recommend using a custom isolation scope instead. To activate the custom isolation scope, you will need to explicitly pass the isolation scope to `use_isolation_scope`, which creates a context manager that activates the scope. Here is an example of how to change your code to make it work:
71
71
72
72
```python diff
73
73
import sentry_sdk
@@ -106,7 +106,7 @@ If you previously used `with sentry_sdk.Hub(sentry_sdk.Hub.current)` to clone th
106
106
107
107
`sentry_sdk.isolation_scope` is a context manager that creates a new isolation scope by forking the current isolation scope. The forked isolation scope is activated during the context manager's lifetime, providing a similar level of isolation within the context manager as the previous `Hub`-based approach.
108
108
109
-
Note that using `sentry_sdk.isolation_scope()` is equivalent to `sentry_sdk.scope.use_isolation_scope(sentry_sdk.Scope.get_isolation_scope().fork())`.
109
+
Note that using `sentry_sdk.isolation_scope()` is equivalent to `sentry_sdk.scope.use_isolation_scope(sentry_sdk.get_isolation_scope().fork())`.
110
110
111
111
### Scope Configuring
112
112
@@ -118,18 +118,18 @@ a task, and so on) or just a specific part of the code.
118
118
If you want your scope change to affect a smaller unit of code such as a span, use the current scope.
119
119
120
120
```python diff
121
-
-with configure_scope() as scope:
121
+
-withsentry_sdk.configure_scope() as scope:
122
122
-# do something with scope
123
-
+ scope =Scope.get_current_scope()
123
+
+ scope =sentry_sdk.get_current_scope()
124
124
+# do something with scope
125
125
```
126
126
127
127
If you want your scope change to affect the whole transaction, use the isolation scope.
0 commit comments