Improve documentation around threading in Python
SDK
Python SDK
Description
This has been feedback from a user of our SDK:
The documentation here mentions that:
The SDK ensures every thread has an independent scope via the ThreadingIntegration.
then the ThreadingIntegration docs mentions that:
This boilerplate is still sometimes necessary if you want to propagate context data into a thread pool, for example.
A doc example for how to do that specifically creating isolation scopes for tasks running in a thread pool would be awesome, or a way in which this would just work automatically would be even better :-)
My example looks like this:
with ThreadPoolExecutor(max_workers=MERGE_BATCH_SIZE) as pool:
loaded_reports = pool.map(load_report, upload_ids)
return list(loaded_reports)
My problem is that the nesting of tracing spans is sometimes completely broken when I have multiple tasks/threads in the above thread pool.
Suggested Solution
Create an example app using the above mentioned ThreadPoolExecutor and see how the traces look like.
Update the documentation so it tells people how to add some custom instrumentation to make the traces look better.