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: MIGRATION_GUIDE.md
+74Lines changed: 74 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of wh
5
5
## New Features
6
6
7
7
- Additional integrations will now be activated automatically if the SDK detects the respective package is installed: Ariadne, ARQ, asyncpg, Chalice, clickhouse-driver, GQL, Graphene, huey, Loguru, PyMongo, Quart, Starlite, Strawberry.
8
+
- Added new API for custom instrumentation: `new_scope`, `isolation_scope`. See the [Deprecated](#deprecated) section to see how they map to the existing APIs.
8
9
9
10
## Changed
10
11
@@ -76,6 +77,79 @@ Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of wh
76
77
77
78
## Deprecated
78
79
80
+
- Using the `Hub` directly as well as using hub-based APIs has been deprecated. Where available, use [the top-level API instead](sentry_sdk/api.py); otherwise use the [scope API](sentry_sdk/scope.py) or the [client API](sentry_sdk/client.py).
81
+
82
+
Before:
83
+
84
+
```python
85
+
with hub.start_span(...):
86
+
# do something
87
+
```
88
+
89
+
After:
90
+
91
+
```python
92
+
import sentry_sdk
93
+
94
+
with sentry_sdk.start_span(...):
95
+
# do something
96
+
```
97
+
98
+
- Hub cloning is deprecated.
99
+
100
+
Before:
101
+
102
+
```python
103
+
with Hub(Hub.current) as hub:
104
+
# do something with the cloned hub
105
+
```
106
+
107
+
After:
108
+
109
+
```python
110
+
import sentry_sdk
111
+
112
+
with sentry_sdk.isolation_scope() as scope:
113
+
# do something with the forked scope
114
+
```
115
+
116
+
-`configure_scope`is deprecated. Use the new isolation scope directly via `Scope.get_isolation_scope()` instead.
117
+
118
+
Before:
119
+
120
+
```python
121
+
with configure_scope() as scope:
122
+
# do something with `scope`
123
+
```
124
+
125
+
After:
126
+
127
+
```python
128
+
from sentry_sdk.scope import Scope
129
+
130
+
scope = Scope.get_isolation_scope()
131
+
# do something with `scope`
132
+
```
133
+
134
+
-`push_scope`is deprecated. Use the new `new_scope` context manager to fork the necessary scopes.
135
+
136
+
Before:
137
+
138
+
```python
139
+
with push_scope() as scope:
140
+
# do something with `scope`
141
+
```
142
+
143
+
After:
144
+
145
+
```python
146
+
import sentry_sdk
147
+
148
+
with sentry_sdk.new_scope() as scope:
149
+
# do something with `scope`
150
+
```
151
+
152
+
- Accessing the client via the hub has been deprecated. Use the top-level `sentry_sdk.get_client()` to get the current client.
79
153
-`profiler_mode`and`profiles_sample_rate` have been deprecated as`_experiments` options. Use them as top level options instead:
0 commit comments