Skip to content
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

feat: Use http.method instead of method #2054

Merged
merged 3 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sentry_sdk/integrations/boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/httpx/test_httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/requests/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/integrations/stdlib/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand All @@ -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",
Expand Down Expand Up @@ -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: "",
Expand Down