@@ -523,10 +523,11 @@ async def dispatch_request(self):
523523
524524
525525@pytest .mark .parametrize ("endpoint" , ["/sync/thread_ids" , "/async/thread_ids" ])
526+ @pytest .mark .asyncio
526527async def test_active_thread_id (sentry_init , capture_envelopes , endpoint , app ):
527528 sentry_init (
528529 traces_sample_rate = 1.0 ,
529- _experiments = { " profiles_sample_rate" : 1.0 } ,
530+ profiles_sample_rate = 1.0 ,
530531 )
531532
532533 envelopes = capture_envelopes ()
@@ -535,19 +536,27 @@ async def test_active_thread_id(sentry_init, capture_envelopes, endpoint, app):
535536 response = await client .get (endpoint )
536537 assert response .status_code == 200
537538
538- data = json .loads (response .content )
539+ data = json .loads (await response .get_data ( as_text = True ) )
539540
540541 envelopes = [envelope for envelope in envelopes ]
541542 assert len (envelopes ) == 1
542543
543544 profiles = [item for item in envelopes [0 ].items if item .type == "profile" ]
544- assert len (profiles ) == 1
545+ assert len (profiles ) == 1 , envelopes [ 0 ]. items
545546
546- for profile in profiles :
547- transactions = profile .payload .json ["transactions" ]
547+ for item in profiles :
548+ transactions = item .payload .json ["transactions" ]
548549 assert len (transactions ) == 1
549550 assert str (data ["active" ]) == transactions [0 ]["active_thread_id" ]
550551
552+ transactions = [item for item in envelopes [0 ].items if item .type == "transaction" ]
553+ assert len (transactions ) == 1
554+
555+ for item in transactions :
556+ transaction = item .payload .json
557+ trace_context = transaction ["contexts" ]["trace" ]
558+ assert str (data ["active" ]) == trace_context ["data" ]["thread.id" ]
559+
551560
552561@pytest .mark .asyncio
553562async def test_span_origin (sentry_init , capture_events , app ):
0 commit comments