Skip to content

Commit cf50600

Browse files
committed
fix: url data and tests
1 parent e1622b4 commit cf50600

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

sentry_sdk/integrations/aiohttp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ async def on_request_start(session, trace_config_ctx, params):
206206
op=OP.HTTP_CLIENT, description="%s %s" % (method, parsed_url)
207207
)
208208
span.set_data(SPANDATA.HTTP_METHOD, method)
209-
span.set_data("url", parsed_url)
209+
span.set_data("url", parsed_url.url)
210210
span.set_data(SPANDATA.HTTP_QUERY, parsed_url.query)
211211
span.set_data(SPANDATA.HTTP_FRAGMENT, parsed_url.fragment)
212212

213-
if should_propagate_trace(hub, parsed_url):
213+
if should_propagate_trace(hub, parsed_url.url):
214214
for key, value in hub.iter_trace_propagation_headers(span):
215215
logger.debug(
216216
"[Tracing] Adding `{key}` header {value} to outgoing request to {url}.".format(

tests/integrations/aiohttp/test_aiohttp.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ async def hello(request):
430430
assert error_event["contexts"]["trace"]["trace_id"] == trace_id
431431

432432

433+
@pytest.mark.asyncio
433434
async def test_crumb_capture(
434435
sentry_init, aiohttp_raw_server, aiohttp_client, loop, capture_events
435436
):
@@ -461,13 +462,16 @@ async def handler(request):
461462
assert crumb["category"] == "httplib"
462463
assert crumb["data"] == {
463464
"url": "http://127.0.0.1:{}/".format(raw_server.port),
464-
"method": "GET",
465-
"status_code": 200,
465+
"http.fragment": "",
466+
"http.method": "GET",
467+
"http.query": "",
468+
"http.response.status_code": 200,
466469
"reason": "OK",
467470
"extra": "foo",
468471
}
469472

470473

474+
@pytest.mark.asyncio
471475
async def test_outgoing_trace_headers(sentry_init, aiohttp_raw_server, aiohttp_client):
472476
sentry_init(
473477
integrations=[AioHttpIntegration()],

0 commit comments

Comments
 (0)