From 0d301bbeabe441632195efd6c42210e3c32bb72e Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Wed, 3 May 2023 16:56:01 +0200 Subject: [PATCH 1/2] Pin urllib3 to <2.0.0 for now (#2069) --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 9dd2e13b79..7940d62d36 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ def get_file_text(file_name): 'urllib3>=1.25.7; python_version<="3.4"', 'urllib3>=1.26.9; python_version=="3.5"', 'urllib3>=1.26.11; python_version >="3.6"', + 'urllib3<2.0.0', "certifi", ], extras_require={ From 019f10c72d75926ed45e9974eb44d4eda0e13e41 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 4 May 2023 08:05:20 +0200 Subject: [PATCH 2/2] feat: Use `http.method` instead of `method` (#2054) Co-authored-by: Anton Pirker --- sentry_sdk/integrations/boto3.py | 1 + sentry_sdk/integrations/httpx.py | 4 ++-- sentry_sdk/integrations/stdlib.py | 2 +- tests/integrations/httpx/test_httpx.py | 2 +- tests/integrations/requests/test_requests.py | 2 +- tests/integrations/stdlib/test_httplib.py | 6 +++--- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sentry_sdk/integrations/boto3.py b/sentry_sdk/integrations/boto3.py index 321549067c..a4eb400666 100644 --- a/sentry_sdk/integrations/boto3.py +++ b/sentry_sdk/integrations/boto3.py @@ -75,6 +75,7 @@ def _sentry_request_created(service_id, request, operation_name, **kwargs): span.set_data("aws.request.url", parsed_url.url) span.set_data(SPANDATA.HTTP_QUERY, parsed_url.query) span.set_data(SPANDATA.HTTP_FRAGMENT, parsed_url.fragment) + span.set_data(SPANDATA.HTTP_METHOD, request.method) # We do it in order for subsequent http calls/retries be # attached to this span. diff --git a/sentry_sdk/integrations/httpx.py b/sentry_sdk/integrations/httpx.py index 1b81358ae4..a7319d9d72 100644 --- a/sentry_sdk/integrations/httpx.py +++ b/sentry_sdk/integrations/httpx.py @@ -48,7 +48,7 @@ def send(self, request, **kwargs): op=OP.HTTP_CLIENT, description="%s %s" % (request.method, parsed_url.url), ) as span: - span.set_data("method", request.method) + span.set_data(SPANDATA.HTTP_METHOD, request.method) span.set_data("url", parsed_url.url) span.set_data(SPANDATA.HTTP_QUERY, parsed_url.query) span.set_data(SPANDATA.HTTP_FRAGMENT, parsed_url.fragment) @@ -89,7 +89,7 @@ async def send(self, request, **kwargs): op=OP.HTTP_CLIENT, description="%s %s" % (request.method, parsed_url.url), ) as span: - span.set_data("method", request.method) + span.set_data(SPANDATA.HTTP_METHOD, request.method) span.set_data("url", parsed_url.url) span.set_data(SPANDATA.HTTP_QUERY, parsed_url.query) span.set_data(SPANDATA.HTTP_FRAGMENT, parsed_url.fragment) diff --git a/sentry_sdk/integrations/stdlib.py b/sentry_sdk/integrations/stdlib.py index b95b64e4be..17b30102b9 100644 --- a/sentry_sdk/integrations/stdlib.py +++ b/sentry_sdk/integrations/stdlib.py @@ -91,7 +91,7 @@ def putrequest(self, method, url, *args, **kwargs): description="%s %s" % (method, parsed_url.url), ) - span.set_data("method", method) + span.set_data(SPANDATA.HTTP_METHOD, method) span.set_data("url", parsed_url.url) span.set_data(SPANDATA.HTTP_QUERY, parsed_url.query) span.set_data(SPANDATA.HTTP_FRAGMENT, parsed_url.fragment) diff --git a/tests/integrations/httpx/test_httpx.py b/tests/integrations/httpx/test_httpx.py index c8764fd94f..dd5e752c32 100644 --- a/tests/integrations/httpx/test_httpx.py +++ b/tests/integrations/httpx/test_httpx.py @@ -43,7 +43,7 @@ def before_breadcrumb(crumb, hint): assert crumb["category"] == "httplib" assert crumb["data"] == { "url": url, - "method": "GET", + SPANDATA.HTTP_METHOD: "GET", SPANDATA.HTTP_FRAGMENT: "", SPANDATA.HTTP_QUERY: "", "status_code": 200, diff --git a/tests/integrations/requests/test_requests.py b/tests/integrations/requests/test_requests.py index da6923e721..324379fc9d 100644 --- a/tests/integrations/requests/test_requests.py +++ b/tests/integrations/requests/test_requests.py @@ -25,7 +25,7 @@ def test_crumb_capture(sentry_init, capture_events): assert crumb["category"] == "httplib" assert crumb["data"] == { "url": url, - "method": "GET", + SPANDATA.HTTP_METHOD: "GET", SPANDATA.HTTP_FRAGMENT: "", SPANDATA.HTTP_QUERY: "", "status_code": response.status_code, diff --git a/tests/integrations/stdlib/test_httplib.py b/tests/integrations/stdlib/test_httplib.py index a1034b770d..959ad1658b 100644 --- a/tests/integrations/stdlib/test_httplib.py +++ b/tests/integrations/stdlib/test_httplib.py @@ -48,7 +48,7 @@ def test_crumb_capture(sentry_init, capture_events): assert crumb["category"] == "httplib" assert crumb["data"] == { "url": url, - "method": "GET", + SPANDATA.HTTP_METHOD: "GET", "status_code": 200, "reason": "OK", SPANDATA.HTTP_FRAGMENT: "", @@ -75,7 +75,7 @@ def before_breadcrumb(crumb, hint): assert crumb["category"] == "httplib" assert crumb["data"] == { "url": url, - "method": "GET", + SPANDATA.HTTP_METHOD: "GET", "status_code": 200, "reason": "OK", "extra": "foo", @@ -133,7 +133,7 @@ def test_httplib_misuse(sentry_init, capture_events, request): assert crumb["category"] == "httplib" assert crumb["data"] == { "url": "http://localhost:{}/200".format(PORT), - "method": "GET", + SPANDATA.HTTP_METHOD: "GET", "status_code": 200, "reason": "OK", SPANDATA.HTTP_FRAGMENT: "",