Skip to content

ref(pymongo): Remove redundant command name in query description #3189

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

Merged
merged 2 commits into from
Jun 21, 2024
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
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def started(self, event):
if not should_send_default_pii():
command = _strip_pii(command)

query = "{} {}".format(event.command_name, command)
query = "{}".format(command)
span = sentry_sdk.start_span(op=op, description=query)

for tag, value in tags.items():
Expand Down
8 changes: 4 additions & 4 deletions tests/integrations/pymongo/test_pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def test_transactions(sentry_init, capture_events, mongo_server, with_pii):
assert insert_success["tags"]["db.operation"] == "insert"
assert insert_fail["tags"]["db.operation"] == "insert"

assert find["description"].startswith("find {")
assert insert_success["description"].startswith("insert {")
assert insert_fail["description"].startswith("insert {")
assert find["description"].startswith("{'find")
assert insert_success["description"].startswith("{'insert")
assert insert_fail["description"].startswith("{'insert")
if with_pii:
assert "1" in find["description"]
assert "2" in insert_success["description"]
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_breadcrumbs(sentry_init, capture_events, mongo_server, with_pii):
(crumb,) = event["breadcrumbs"]["values"]

assert crumb["category"] == "query"
assert crumb["message"].startswith("find {")
assert crumb["message"].startswith("{'find")
if with_pii:
assert "1" in crumb["message"]
else:
Expand Down
Loading