Commit e043a2f
committed
fix(starlette): Set transaction name on current scope in sync handler
The sync request/response handler passed the _isolation_ scope to
`_set_transaction_name_and_source`, but the transaction/segment span lives on
the _current_ scope. As a result the route-resolved name never reached the span
for sync endpoints, which were instead named by the raw URL from the ASGI
middleware (`transaction_info.source` of `url` rather than `route`). Async
handlers already used the current scope and were unaffected.
Pass the current scope (already computed above) so sync and async handlers
behave identically:
- streaming: the segment name / `sentry.segment.name.source` are route-based
- static: the transaction event name / source are route-based
For parametrized routes this also removes high-cardinality URL transaction
names for sync endpoints.1 parent 1c3b50d commit e043a2f
2 files changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1499 | 1499 | | |
1500 | 1500 | | |
1501 | 1501 | | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
1502 | 1546 | | |
1503 | 1547 | | |
1504 | 1548 | | |
| |||
0 commit comments