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

Add db.system to the span data for mongo db. #2042

Merged
merged 12 commits into from
Apr 27, 2023
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ def started(self, event):
except TypeError:
pass

data = {"operation_ids": {}} # type: Dict[str, Dict[str, Any]]
data = {"operation_ids": {}} # type: Dict[str, Union[Dict[str, Any], str]]

data["operation_ids"]["operation"] = event.operation_id
data["operation_ids"]["request"] = event.request_id
data["db.system"] = "mongodb"
antonpirker marked this conversation as resolved.
Show resolved Hide resolved

try:
lsid = command.pop("lsid")["id"]
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/pymongo/test_pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_transactions(sentry_init, capture_events, mongo_server, with_pii):
"net.peer.port": str(mongo_server.port),
}
for span in find, insert_success, insert_fail:
assert span["data"]["db.system"] == "mongodb"
for field, value in common_tags.items():
assert span["tags"][field] == value

Expand Down