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
{{ message }}
Repository navigation
Commit eca23b8
Browse filesBrowse the repository at this point in the historyBrowse files
We have some classes in the SDK that essentially function as abstract classes, since they have some methods that raise NotImplementedError when called, since they are intended to be overriden by a subclass. Now that all supported Python versions support abstract base classes (ABCs), we should refactor these classes to be ABCs. Making this change will explicitly indicate which methods need to be overridden by a subclass.
Changing a public class into an ABC is a breaking change, since instantiating the class, or any subclass that hasn't overridden all abstract methods, will raise an error. Therefore, I have added this (draft) PR to the SDK 2.0 milestone.
* Convert `Transport` class into an ABC
* ABC metrics
* ABC scheduler
* ABC integration
* RequestExtractor comment
* Deprecate `stop_profiling` and stop calling it
This change is required because otherwise, the linter complains about the `stop_profiling` being an empty concrete method in an abstract class.
* Actually, let's remove `stop_profiling`
* Add ABCs to migration guide
* fix mypy
* Make docstring more relevant to users
* `ensure_running` no longer abstract
* Fix mypy
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,18 @@ Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of wh
15
15
- The `reraise` function was moved from `sentry_sdk._compat` to `sentry_sdk.utils`.
16
16
- Moved the contents of `tracing_utils_py3.py` to `tracing_utils.py`. The `start_child_span_decorator` is now in `sentry_sdk.tracing_utils`.
17
17
- 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
+
- The classes listed in the table below are now abstract base classes. Therefore, they can no longer be instantiated. Subclasses can only be instantiated if they implement all of the abstract methods.
@@ -33,16 +45,17 @@ Looking to upgrade from Sentry SDK 1.x to 2.x? Here's a comprehensive list of wh
33
45
- Removed `sentry_sdk.utils.Auth.store_api_url`.
34
46
-`sentry_sdk.utils.Auth.get_api_url`'s now accepts a `sentry_sdk.consts.EndpointType` enum instead of a string as its only parameter. We recommend omitting this argument when calling the function, since the parameter's default value is the only possible `sentry_sdk.consts.EndpointType` value. The parameter exists for future compatibility.
35
47
- Removed `tracing_utils_py2.py`. The `start_child_span_decorator` is now in `sentry_sdk.tracing_utils`.
48
+
- Removed the `sentry_sdk.profiler.Scheduler.stop_profiling` method. Any calls to this method can simply be removed, since this was a no-op method.
36
49
37
50
## Deprecated
38
51
39
52
-`profiler_mode` and `profiles_sample_rate` have been deprecated as `_experiments` options. Use them as top level options instead:
40
-
```python
41
-
sentry_sdk.init(
42
-
...,
43
-
profiler_mode="thread",
44
-
profiles_sample_rate=1.0,
45
-
)
46
-
```
53
+
```python
54
+
sentry_sdk.init(
55
+
...,
56
+
profiler_mode="thread",
57
+
profiles_sample_rate=1.0,
58
+
)
59
+
```
47
60
- Deprecated `sentry_sdk.transport.Transport.capture_event`. Please use `sentry_sdk.transport.Transport.capture_envelope`, instead.
48
61
- 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.
0 commit comments