8000 fix: Do not persist httplib response in breadcrumbs · etherscan-io/sentry-python@057b136 · GitHub
[go: up one dir, main page]

Skip to content

Commit 057b136

Browse files
committed
fix: Do not persist httplib response in breadcrumbs
1 parent 2758f65 commit 057b136

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sentry_sdk/tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,13 @@ def _maybe_create_breadcrumbs_from_span(hub, span):
402402
type="http",
403403
category="httplib",
404404
data=span._data,
405-
hint={"httplib_response": span._data.get("httplib_response")},
405+
hint={"httplib_response": span._data.pop("httplib_response", None)},
406406
)
407407
elif span.op == "subprocess":
408408
hub.add_breadcrumb(
409409
type="subprocess",
410410
category="subprocess",
411411
message=span.description,
412412
data=span._data,
413-
hint={"popen_instance": span._data.get("popen_instance")},
413+
hint={"popen_instance": span._data.pop("popen_instance", None)},
414414
)

tests/integrations/stdlib/test_httplib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import pytest
23

34
try:
@@ -32,7 +33,6 @@ def test_crumb_capture(sentry_init, capture_events):
3233
"method": "GET",
3334
"status_code": 200,
3435
"reason": "OK",
35-
"httplib_response": crumb["data"]["httplib_response"],
3636
}
3737

3838

@@ -62,9 +62,10 @@ def before_breadcrumb(crumb, hint):
6262
"status_code": 200,
6363
"reason": "OK",
6464
"extra": "foo",
65-
"httplib_response": crumb["data"]["httplib_response"],
6665
}
6766

67+
assert sys.getrefcount(response) == 2
68+
6869

6970
def test_httplib_misuse(sentry_init, capture_events):
7071
"""HTTPConnection.getresponse must be called after every call to
@@ -104,5 +105,4 @@ def test_httplib_misuse(sentry_init, capture_events):
104105
"method": "GET",
105106
"status_code": 200,
106107
"reason": "OK",
107-
"httplib_response": crumb["data"]["httplib_response"],
108108
}

0 commit comments

Comments
 (0)
0