Skip to content

Commit aecb81f

Browse files
authored
feat: Add trace propagation to aiohttp integration (getsentry#542)
1 parent 68ddcf4 commit aecb81f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sentry_sdk/integrations/aiohttp.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
request_body_within_bounds,
1111
)
1212
from sentry_sdk.serializer import partial_serialize
13+
from sentry_sdk.tracing import Span
1314
from sentry_sdk.utils import (
1415
capture_internal_exceptions,
1516
event_from_exception,
@@ -70,9 +71,13 @@ async def inner():
7071
scope.clear_breadcrumbs()
7172
scope.add_event_processor(_make_request_processor(weak_request))
7273

74+
span = Span.continue_from_headers(request.headers)
75+
span.op = "http.server"
7376
# If this transaction name makes it to the UI, AIOHTTP's
7477
# URL resolver did not find a route or died trying.
75-
with hub.start_span(transaction="generic AIOHTTP request"):
78+
span.transaction = "generic AIOHTTP request"
79+
80+
with hub.start_span(span):
7681
try:
7782
response = await old_handle(self, request)
7883
except HTTPException:

0 commit comments

Comments
 (0)