-
Notifications
You must be signed in to change notification settings - Fork 649
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
Adding pymongo integration #232
Conversation
for start_time and end_time
Is this based on OpenCensus, or OpenTracing, or is it a completely new implementation? |
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
@Oberon00 I took OpenCensus as starting point, I could not find any pymongo integration for OpenTracing, some properties are different and we are getting more information in the span attributes now. |
avoid conflicts with asynchronous traces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Oberon00 let me know if you have more feedback |
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @hectorhdzg, I think the code looks quite solid now.
Unfortunately, I have to request changes yet again because I'm pretty sure the unit tests aren't being run in the CI (you can verify locally by running just tox
without the -e
option and checking the output at the end for a line like py37-test-ext-pymongo: commands succeeded
).
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
for attr in COMMAND_ATTRIBUTES: | ||
_attr = event.command.get(attr) | ||
if _attr is not None: | ||
span.set_attribute("db.mongo." + attr, str(_attr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On using str
: Shouldn't e.g. limit
be an integer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string casting is more important for other fields, dictionaries and lists are also part of COMMAND_ATTRIBUTES, I can add specific checks for limit and skip(both int) if the type is important here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at this point, it would be simpler to take "limit"
out of COMMAND_ATTRIBUTES
and query it separately.
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍 Thanks for going through all these rounds of comments!
@open-telemetry/python-approvers: If someone has knowledge of MongoDB (I don't), I'd love another review on this before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
==========================================
- Coverage 85.5% 84.77% -0.74%
==========================================
Files 33 33
Lines 1608 1589 -19
Branches 181 180 -1
==========================================
- Hits 1375 1347 -28
- Misses 186 195 +9
Partials 47 47
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after fixing version numbers, but my review is taking a lot of the expected behavior on faith. It would be helpful to have an example or integration test here, or a better description in the package readme.
I agree with @Oberon00 that we'd benefit from a reviewer familiar with mongo, but don't want to hold this PR up.
ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/version.py
Outdated
Show resolved
Hide resolved
… (open-telemetry#232) * fix: enable async hooks manager in node tracer * fix(node-tracer): set scope manager as optional
Database fields
https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-semantic-conventions.md#databases-client-calls
#209