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: src/platforms/python/common/troubleshooting.mdx
+5-17Lines changed: 5 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,11 @@ taken. This is specially true when working with a code base doing concurrency
29
29
outside of the provided framework integrations.
30
30
31
31
The general recommendation is to have one hub per "concurrency unit"
32
-
(thread/coroutine/etc). The SDK ensures every thread has an independent hub. If
33
-
you do concurrency with `asyncio` coroutines, clone the current hub for use
34
-
within a block that runs concurrent code:
32
+
(thread/coroutine/etc). The SDK ensures every thread has an independent hub via the `ThreadingIntegration`.
33
+
If you do concurrency with `asyncio` coroutines, make sure to use the `AsyncioIntegration`
34
+
that will clone the current hub in your `Task`s.
35
+
36
+
The general pattern of usage for cloning the hub is:
35
37
36
38
```python
37
39
with Hub(Hub.current):
@@ -40,10 +42,6 @@ with Hub(Hub.current):
40
42
# the same initial scope data.
41
43
```
42
44
43
-
Issues with `asyncio` have then an easy workaround: every `asyncio` coroutine
44
-
that really does run concurrently with other coroutines needs to be made into a
45
-
task, then the hub needs to be cloned and reassigned.
46
-
47
45
See the [Threading](../configuration/integrations/default-integrations/#threading) section
48
46
for a more complete example that involves cloning the current hub.
49
47
@@ -114,13 +112,3 @@ be fixed from within the SDK.
114
112
115
113
This [issue has been fixed with gevent 20.5](https://github.com/gevent/gevent/issues/1407) but continues to be one for
116
114
eventlet.
117
-
118
-
<PlatformSectionsupported={["python.django"]}>
119
-
120
-
## Django Channels
121
-
122
-
A Django application using Channels 2.0 will be correctly instrumented under Python 3.7. For older versions of Python, install `aiocontextvars` from PyPI or your application will not start.
123
-
124
-
If you experience memory leaks in your channels' consumers while using the SDK, you need to wrap your entire application in [Sentry's ASGI middleware](/platforms/python/guides/asgi/). Unfortunately the SDK is not able to do so by itself, as [Channels is missing some hooks for instrumentation](https://github.com/django/channels/issues/1348).
0 commit comments