Skip to content

Commit 09b4a01

Browse files
authored
Fix aiohttp tests (#3771)
Remove explicit trace_id passing
1 parent fccf50b commit 09b4a01

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

MIGRATION_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
1111
- The SDK now supports Python 3.7 and higher.
1212
- `sentry_sdk.start_span` now only takes keyword arguments.
1313
- `sentry_sdk.start_span` no longer takes an explicit `span` argument.
14+
- `sentry_sdk.start_span` no longer takes explicit `trace_id`, `span_id` or `parent_span_id` arguments.
1415
- The `Span()` constructor does not accept a `hub` parameter anymore.
1516
- `Span.finish()` does not accept a `hub` parameter anymore.
1617
- The `Profile()` constructor does not accept a `hub` parameter anymore.

tests/integrations/aiohttp/test_aiohttp.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,6 @@ async def handler(request):
535535
with start_transaction(
536536
name="/interactions/other-dogs/new-dog",
537537
op="greeting.sniff",
538-
# make trace_id difference between transactions
539-
trace_id="0123456789012345678901234567890",
540538
) as transaction:
541539
client = await aiohttp_client(raw_server)
542540
resp = await client.get("/")
@@ -572,14 +570,21 @@ async def handler(request):
572570
with start_transaction(
573571
name="/interactions/other-dogs/new-dog",
574572
op="greeting.sniff",
575-
trace_id="0123456789012345678901234567890",
576-
):
573+
) as transaction:
577574
client = await aiohttp_client(raw_server)
578575
resp = await client.get("/", headers={"bagGage": "custom=value"})
579576

580577
assert (
581-
resp.request_info.headers["baggage"]
582-
== "custom=value,sentry-trace_id=0123456789012345678901234567890,sentry-environment=production,sentry-release=d08ebdb9309e1b004c6f52202de58a09c2268e42,sentry-transaction=/interactions/other-dogs/new-dog,sentry-sample_rate=1.0,sentry-sampled=true"
578+
sorted(resp.request_info.headers["baggage"].split(","))
579+
== sorted([
580+
"custom=value",
581+
f"sentry-trace_id={transaction.trace_id}",
582+
"sentry-environment=production",
583+
"sentry-release=d08ebdb9309e1b004c6f52202de58a09c2268e42",
584+
"sentry-transaction=/interactions/other-dogs/new-dog",
585+
"sentry-sample_rate=1.0",
586+
"sentry-sampled=true",
587+
])
583588
)
584589

585590

0 commit comments

Comments
 (0)