Skip to content

Conversation

@0Calories
Copy link
Contributor

@0Calories 0Calories commented Jul 12, 2024

MongoDB queries were being sent as invalid JSON, since the keys and values were surrounded by single quotes instead of double quotes. Relay cannot parse the queries unless they are sent as valid JSON. This PR converts MongoDB queries into a JSON string before sending it on the span, so that Relay may properly parse it and extract metrics.

Before

image

After

image

@0Calories 0Calories self-assigned this Jul 12, 2024
@0Calories 0Calories requested a review from antonpirker July 12, 2024 21:07
@0Calories 0Calories marked this pull request as ready for review July 12, 2024 21:07
@codecov
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.41%. Comparing base (301c4b8) to head (8adea02).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3291   +/-   ##
=======================================
  Coverage   79.40%   79.41%           
=======================================
  Files         132      132           
  Lines       14281    14282    +1     
  Branches     2999     2999           
=======================================
+ Hits        11340    11342    +2     
  Misses       2094     2094           
+ Partials      847      846    -1     
Files Coverage Δ
sentry_sdk/integrations/pymongo.py 84.16% <100.00%> (+0.13%) ⬆️

... and 1 file with indirect coverage changes

@antonpirker antonpirker merged commit 84a2afc into master Jul 15, 2024
@antonpirker antonpirker deleted the ashanand/pymongo/query-string-as-json branch July 15, 2024 06:58
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
MongoDB queries were being sent as invalid JSON, since the keys and values were surrounded by single quotes instead of double quotes. Relay cannot parse the queries unless they are sent as valid JSON. This PR converts MongoDB queries into a JSON string before sending it on the span, so that Relay may properly parse it and extract metrics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants