fix(integrations): asyncio: continuation trace transactions #5526
3 issues
find-bugs: Found 3 issues (1 high, 2 medium)
High
Hardcoded transaction name 'downstream' loses coroutine-specific tracing context - `sentry_sdk/integrations/asyncio.py:77`
The new code uses a hardcoded name="downstream" instead of name=get_name(coro) which previously captured the actual coroutine function name (e.g., 'foo', 'bar'). This eliminates meaningful trace identification - all async tasks will now appear as 'downstream' rather than their actual function names, making debugging and performance analysis significantly harder.
Medium
Origin attribute not set on new transactions, breaking trace origin tracking - `sentry_sdk/integrations/asyncio.py:76-78`
The original code set origin=AsyncioIntegration.origin (which equals 'auto.function.asyncio') on spans. The new transaction creation doesn't pass an origin, so it will default to 'manual'. This breaks the test at test_asyncio.py:395 which expects event["spans"][0]["origin"] == "auto.function.asyncio" and loses the ability to identify spans created by the asyncio integration.
Changed conditional skips span creation when task_spans=True but no active span exists - `sentry_sdk/integrations/asyncio.py:75`
The condition changed from if task_spans to if task_spans and in_span. This means when task_spans=True but there's no current active span (in_span=False), no transaction/span will be created at all. Previously, a span would still be created in this case. This is a behavioral change that could result in missing traces for orphaned async tasks.
Duration: 1m 29s · Tokens: 193.3k in / 3.4k out · Cost: $0.29 (+extraction: $0.01, +merge: $0.00)
Annotations
Check failure on line 77 in sentry_sdk/integrations/asyncio.py
github-actions / warden: find-bugs
Hardcoded transaction name 'downstream' loses coroutine-specific tracing context
The new code uses a hardcoded `name="downstream"` instead of `name=get_name(coro)` which previously captured the actual coroutine function name (e.g., 'foo', 'bar'). This eliminates meaningful trace identification - all async tasks will now appear as 'downstream' rather than their actual function names, making debugging and performance analysis significantly harder.
Check warning on line 78 in sentry_sdk/integrations/asyncio.py
github-actions / warden: find-bugs
Origin attribute not set on new transactions, breaking trace origin tracking
The original code set `origin=AsyncioIntegration.origin` (which equals 'auto.function.asyncio') on spans. The new transaction creation doesn't pass an origin, so it will default to 'manual'. This breaks the test at test_asyncio.py:395 which expects `event["spans"][0]["origin"] == "auto.function.asyncio"` and loses the ability to identify spans created by the asyncio integration.
Check warning on line 75 in sentry_sdk/integrations/asyncio.py
github-actions / warden: find-bugs
Changed conditional skips span creation when task_spans=True but no active span exists
The condition changed from `if task_spans` to `if task_spans and in_span`. This means when `task_spans=True` but there's no current active span (`in_span=False`), no transaction/span will be created at all. Previously, a span would still be created in this case. This is a behavioral change that could result in missing traces for orphaned async tasks.