Skip to content

Commit ad4ff19

Browse files
committed
Updated migration guide
1 parent 656ac9d commit ad4ff19

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

MIGRATION_GUIDE.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,35 @@ Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of wh
88

99
## Changed
1010

11-
- Setting the parameter `propagate_hub` to `True` in `ThreadingIntegration(propagate_hub=True)` only works on Python 3.7+.
1211
- The Pyramid integration will not capture errors that might happen in `authenticated_userid()` in a custom `AuthenticationPolicy` class.
1312
- The method `need_code_loation` of the `MetricsAggregator` was renamed to `need_code_location`.
1413
- The `BackgroundWorker` thread used to process events was renamed from `raven-sentry.BackgroundWorker` to `sentry-sdk.BackgroundWorker`.
1514
- The `reraise` function was moved from `sentry_sdk._compat` to `sentry_sdk.utils`.
15+
- The `_ScopeManager` was moved from `sentry_sdk.hub` to `sentry_sdk.scope`.
1616
- Moved the contents of `tracing_utils_py3.py` to `tracing_utils.py`. The `start_child_span_decorator` is now in `sentry_sdk.tracing_utils`.
1717
- The actual implementation of `get_current_span` was moved to `sentry_sdk.tracing_utils`. `sentry_sdk.get_current_span` is still accessible as part of the top-level API.
18+
- `sentry_sdk.tracing_utils.get_current_span()` does now take a `scope` instead of a `hub` as parameter.
19+
- `sentry_sdk.utils._get_contextvars` does not return a tuple with three values, but a tuple with two values. The `copy_context` was removed.
20+
- If you create a transaction manually and later mutate the transaction in a `configure_scope` block this does not work anymore. Here is a recipe on how to change your code to make it work:
21+
Your existing implementation:
22+
```python
23+
transaction = sentry_sdk.transaction(...)
24+
25+
# later in the code execution:
26+
27+
with sentry_sdk.configure_scope() as scope:
28+
scope.set_transaction_name("new-transaction-name")
29+
```
30+
31+
needs to be changed to this:
32+
```python
33+
transaction = sentry_sdk.transaction(...)
34+
35+
# later in the code execution:
36+
37+
scope = sentry_sdk.Scope.get_current_scope()
38+
scope.set_transaction_name("new-transaction-name")
39+
```
1840

1941
## Removed
2042

@@ -46,3 +68,4 @@ Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of wh
4668
```
4769
- Deprecated `sentry_sdk.transport.Transport.capture_event`. Please use `sentry_sdk.transport.Transport.capture_envelope`, instead.
4870
- Passing a function to `sentry_sdk.init`'s `transport` keyword argument has been deprecated. If you wish to provide a custom transport, please pass a `sentry_sdk.transport.Transport` instance or a subclass.
71+
- The parameter `propagate_hub` in `ThreadingIntegration()` was deprecated and renamed to `propagate_scope`.

0 commit comments

Comments
 (0)