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/collections/_documentation/platforms/python/default-integrations.md
+50Lines changed: 50 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -78,3 +78,53 @@ See [_Logging_]({% link _documentation/platforms/python/logging.md %})
78
78
Reports crashing threads.
79
79
80
80
It also accepts an option `propagate_hub` that changes the way clients are transferred between threads, and transfers scope data (such as tags) from the parent thread to the child thread. This option is currently disabled (`False`) by default, but this will likely change in the future.
81
+
82
+
Next are two code samples that demonstrate what boilerplate you would have to write without `propagate_hub`. This boilerplate is still sometimes necessary if you want to propagate context data into a thread pool, for example.
83
+
84
+
### Manual propagation
85
+
86
+
```python
87
+
import threading
88
+
from sentry_sdk import Hub, init, configure_scope, capture_message
89
+
90
+
init(...)
91
+
92
+
with configure_scope() as scope:
93
+
scope.set_tag("mydata", 42)
94
+
95
+
defrun(thread_hub):
96
+
with thread_hub:
97
+
capture_message("hi") # event will have `mydata` tag attached
98
+
99
+
# We take all context data (the tags map and even the entire client
100
+
# configuration), and pass it as explicit variable
0 commit comments