Skip to content

Commit 1a38de3

Browse files
committed
also add query for asgi
1 parent 471ad40 commit 1a38de3

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

MIGRATION_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
4141
| `type` | `network.protocol.name` |
4242
| `scheme` | `url.scheme` |
4343
| `path` | `url.path` |
44+
| `query` | `url.query` |
4445
| `http_version` | `network.protocol.version` |
4546
| `method` | `http.request.method` |
4647
| `server` | `server.address`, `server.port` |

sentry_sdk/integrations/asgi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ def _prepopulate_attributes(scope):
356356
full_url = _get_url(scope)
357357
query = _get_query(scope)
358358
if query:
359+
attributes["url.query"] = query
359360
full_url = f"{full_url}?{query}"
360361

361362
attributes["url.full"] = full_url

tests/integrations/asgi/test_asgi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ async def test_asgi_scope_in_traces_sampler(sentry_init, asgi3_app):
728728
def dummy_traces_sampler(sampling_context):
729729
assert sampling_context["url.path"] == "/test"
730730
assert sampling_context["url.scheme"] == "http"
731+
assert sampling_context["url.query"] == "hello=there"
731732
assert sampling_context["url.full"] == "/test?hello=there"
732733
assert sampling_context["http.request.method"] == "GET"
733734
assert sampling_context["network.protocol.version"] == "1.1"

0 commit comments

Comments
 (0)