-
Notifications
You must be signed in to change notification settings - Fork 562
feat: Add source information for slow outgoing HTTP requests #4902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
a1386b0
3c2451d
91ec188
3b054b6
2795125
627e914
77937e9
b431243
f7fab1f
626f693
ea71308
9ece50f
4395ab1
c6e53c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,11 @@ | |
from sentry_sdk.consts import OP, SPANDATA | ||
from sentry_sdk.integrations import Integration | ||
from sentry_sdk.scope import add_global_event_processor | ||
from sentry_sdk.tracing_utils import EnvironHeaders, should_propagate_trace | ||
from sentry_sdk.tracing_utils import ( | ||
EnvironHeaders, | ||
should_propagate_trace, | ||
add_http_request_source, | ||
) | ||
from sentry_sdk.utils import ( | ||
SENSITIVE_DATA_SUBSTITUTE, | ||
capture_internal_exceptions, | ||
|
@@ -135,6 +139,9 @@ def getresponse(self, *args, **kwargs): | |
finally: | ||
span.finish() | ||
|
||
with capture_internal_exceptions(): | ||
add_http_request_source(span) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I placed It's done analogously in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fun fact: It'd be a concern in (P)OTel as finished OTel spans can't be modified, but Sentry spans can so all good. |
||
|
||
return rv | ||
|
||
HTTPConnection.putrequest = putrequest # type: ignore[method-assign] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
import os | ||
import sys | ||
import pytest | ||
|
||
pytest.importorskip("aiohttp") | ||
|
||
# Load `aiohttp_helpers` into the module search path to test request source path names relative to module. See | ||
# `test_request_source_with_module_in_search_path` | ||
sys.path.insert(0, os.path.join(os.path.dirname(__file__))) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
async def get_request_with_client(client, url): | ||
await client.get(url) |
Uh oh!
There was an error while loading. Please reload this page.