Currently, the opt-in AsyncioIntegration is responsible for multiple things, one of them being providing proper scope isolation in asyncio tasks. Without this functionality, people are running into different types of hard-to-diagnose scope bleed issues, like here.
Goal
- Automatically patch the current event loop to isolate tasks in their isolation scopes, if there is an event loop running
- For additional functionality (creating task spans, etc.), explicit opt-in should still be required from users
How to do this
Different ways to do this, each with its own caveats (e.g. introducing breaking changes).
- Take the isolation scope logic out of
AsyncioIntegration into its own integration and make it auto-enabled (best effort, if there is no event loop we can't do anything).
- Make
AsyncioIntegration auto-enabled, and change the additional functions it's providing (like task spans) to be opt-in. Also, make it fail gracefully if there is no event loop to patch.
- ???
When picking an option, consider:
- Will this break behavior for existing users using the
AsyncioIntegration?
- Is there a risk of double-patching the event loop?
Currently, the opt-in
AsyncioIntegrationis responsible for multiple things, one of them being providing proper scope isolation in asyncio tasks. Without this functionality, people are running into different types of hard-to-diagnose scope bleed issues, like here.Goal
How to do this
Different ways to do this, each with its own caveats (e.g. introducing breaking changes).
AsyncioIntegrationinto its own integration and make it auto-enabled (best effort, if there is no event loop we can't do anything).AsyncioIntegrationauto-enabled, and change the additional functions it's providing (like task spans) to be opt-in. Also, make it fail gracefully if there is no event loop to patch.When picking an option, consider:
AsyncioIntegration?