-
Notifications
You must be signed in to change notification settings - Fork 658
ref(httpx,httpx2): Move crumbs to integrations #7149
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 all commits
07a3ea3
2f91234
c3aea86
15d2e2f
53ab7f0
0ea13df
2f54487
8e6087f
91fe6a4
5858c87
906838b
4e093aa
040f223
7472af9
8ace993
f492ba4
8e3adaf
2a172c1
1239d84
9adbede
abdc32b
d03072b
689d9d1
8bfb879
405fb12
31486cf
ccf1de9
0de51ad
1bdf216
62ca144
86c8163
579d224
3e992fb
8ca14b3
720071a
f1312f7
58c435a
e31a3aa
e32ac38
9c2b924
0d6d54d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| from sentry_sdk.integrations import DidNotEnable, Integration | ||
| from sentry_sdk.scope import should_send_default_pii | ||
| from sentry_sdk.tracing_utils import ( | ||
| add_http_breadcrumb, | ||
| add_http_request_source, | ||
| has_span_streaming_enabled, | ||
| propagate_trace_headers, | ||
|
|
@@ -128,6 +129,23 @@ | |
| with capture_internal_exceptions(): | ||
| add_http_request_source(span) | ||
|
|
||
| breadcrumb_data = { | ||
| SPANDATA.HTTP_METHOD: request.method, | ||
| SPANDATA.HTTP_STATUS_CODE: rv.status_code, | ||
| "reason": rv.reason_phrase, | ||
| } | ||
|
|
||
| if parsed_url and (not is_span_streaming_enabled or should_send_default_pii()): | ||
| breadcrumb_data.update( | ||
| { | ||
| "url": parsed_url.url, | ||
| SPANDATA.HTTP_QUERY: parsed_url.query, | ||
| SPANDATA.HTTP_FRAGMENT: parsed_url.fragment, | ||
| } | ||
| ) | ||
|
|
||
| add_http_breadcrumb(rv.status_code, breadcrumb_data) | ||
|
|
||
| return rv | ||
|
|
||
| Client.send = send # type: ignore | ||
|
|
@@ -220,6 +238,22 @@ | |
| with capture_internal_exceptions(): | ||
| add_http_request_source(span) | ||
|
|
||
| breadcrumb_data = { | ||
| SPANDATA.HTTP_METHOD: request.method, | ||
| SPANDATA.HTTP_STATUS_CODE: rv.status_code, | ||
| "reason": rv.reason_phrase, | ||
| } | ||
| if parsed_url and (not is_span_streaming_enabled or should_send_default_pii()): | ||
| breadcrumb_data.update( | ||
| { | ||
| "url": parsed_url.url, | ||
| SPANDATA.HTTP_QUERY: parsed_url.query, | ||
| SPANDATA.HTTP_FRAGMENT: parsed_url.fragment, | ||
| } | ||
| ) | ||
|
|
||
| add_http_breadcrumb(rv.status_code, breadcrumb_data) | ||
|
Check warning on line 255 in sentry_sdk/integrations/httpx.py
|
||
|
Comment on lines
+253
to
+255
Contributor
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. HTTPX breadcrumbs are silently skipped when the request raises When Evidence
Identified by Warden · code-review · B7U-CFR |
||
|
|
||
| return rv | ||
|
|
||
| AsyncClient.send = send # type: ignore | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
is_not_span_streaming_enabledpart is there for continuity in transaction mode, where we don't care aboutshould_send_default_piibefore setting breadcrumb data.