ext/pymongo: Add instrumentor interface#598
Closed
codeboten wants to merge 3 commits intoopen-telemetry:masterfrom
Closed
ext/pymongo: Add instrumentor interface#598codeboten wants to merge 3 commits intoopen-telemetry:masterfrom
codeboten wants to merge 3 commits intoopen-telemetry:masterfrom
Conversation
b39f98f to
8ffad29
Compare
62f28eb to
68fb7c5
Compare
The current Pymongo integration uses the monitoring.register() [1] to hook the different internal calls of Pymongo. This integration doesn't allow to unregister a monitor. This commit workaround that limitation by adding an enable flag to the CommandTracer class and adds a logic to disable the integration. This solution is not perfect becasue there will be some overhead even when the instrumentation is disabled, but that's what we can do with the current approach. [1] https://api.mongodb.com/python/current/api/pymongo/monitoring.html#pymongo.monitoring.register
Pop span instead of getting and then removing it.
68fb7c5 to
8f7b1ca
Compare
Member
|
To make the review process more simple, i.e, avoiding me to review my own changes I'm opening a new PR #612. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mauricio: I took over this one.
This PR implements the Instrumentor interface for the Pymongo integration. It also implements a way to disable instrumentation.
I compared with the DataDog donated implementation available at https://github.com/open-telemetry/opentelemetry-python-contrib/tree/master/reference/ddtrace/contrib/pymongo, the already existing implementation is good enough and we do not need to take any from that in this case.
This PR conflicts with #602, I'll keep as draft until that one is merged.