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

[mongodb] Fix pymongo query metadata #706

Merged
merged 10 commits into from
Nov 13, 2018
Merged

Conversation

majorgreys
Copy link
Collaborator

@majorgreys majorgreys commented Nov 9, 2018

  • Use _Query.name if it is available for more accurate command names, since v3.1.
  • Set mongodb.query tag to ensure the query is shown in the UI

We also need to check in on the obfuscator for mongodb.query, it did not appear to work when I ran it locally, so I needed to use normalize_filter(cmd.query)

@majorgreys majorgreys self-assigned this Nov 9, 2018
ddtrace/contrib/pymongo/parse.py Outdated Show resolved Hide resolved
tests/contrib/pymongo/test.py Outdated Show resolved Hide resolved
ddtrace/contrib/pymongo/client.py Outdated Show resolved Hide resolved
@brettlangdon
Copy link
Member

looks like mongoengine tests also need to be updated.

Copy link
Member

@brettlangdon brettlangdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor changes, but otherwise looking good.

tests/contrib/mongoengine/test.py Outdated Show resolved Hide resolved
tests/contrib/pymongo/test.py Show resolved Hide resolved
ddtrace/contrib/pymongo/client.py Show resolved Hide resolved
@majorgreys majorgreys changed the title Fix pymongo [mongodb] Fix pymongo query metadata Nov 12, 2018
@majorgreys majorgreys dismissed brettlangdon’s stale review November 13, 2018 18:04

Minor changes resolved

@majorgreys majorgreys changed the base branch from master to 0.17-dev November 13, 2018 19:18
Copy link
Member

@Kyle-Verhoog Kyle-Verhoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the span_type to 'mongodb and having the query set on the 'mongo.query' tag should have the trace agent obfuscate the query. Was this still not working?

Other than that looks good to me.

@brettlangdon
Copy link
Member

@Kyle-Verhoog from my basic testing, yeah, didn't seem like it was working :/

@majorgreys majorgreys merged commit 5c29d39 into 0.17-dev Nov 13, 2018
@majorgreys majorgreys deleted the brettlangdon/fix.pymongo branch November 13, 2018 21:51
Kyle-Verhoog pushed a commit that referenced this pull request Nov 23, 2018
* [pymongo] use _Query.name if available otherwise defaul to 'query'

* [pymongo] set mongodb.query tag

* Update test for `_Query.name` change

* Add test for query tag

* Refactor query command metadata

* Fix mongoengine tests

* Pull import up

* Add comments
@brettlangdon brettlangdon added this to the 0.17.0 milestone Dec 3, 2018
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.

None yet

3 participants