-
Notifications
You must be signed in to change notification settings - Fork 143
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
Fixing broken instrumentation for sqlalchemy >= 1.4.0 #289
Conversation
Codecov Report
@@ Coverage Diff @@
## master #289 +/- ##
===========================================
- Coverage 79.63% 31.98% -47.66%
===========================================
Files 83 83
Lines 3276 3286 +10
===========================================
- Hits 2609 1051 -1558
- Misses 667 2235 +1568
Continue to review full report at Codecov.
|
Looks like sqlalchemy 1.4.0 broke two functionalities in the x-ray SDK.
As mentioned in the |
One thing we can do is since wrapt.wrap_function_wrapper(
'sqlalchemy.orm.session',
'Session.execute',
_xray_traced_sqlalchemy_session
) This seem to work fine and record a subsegment for ATM, I can say that for ORM style statement execution, it is safest to use the SQLAlchemy integration rather than patching |
I believe the reason for such a massive drop in the coverage is due to the fact that every test is run with This makes the coverage report quite unreliable, and the solution is to generate different coverage report for each test run and aggregate them together in a codecov report. |
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.
@srprash Is the coverage issue introduced by this PR or it already was there? The tox.ini
change doesn't seem to be adding any new patterns
@anuraaga My suspicion is that the issue was always there and was sometimes encountered in PRs like this which saw decreased in coverage despite adding more tests. |
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.
Cool in that case I don't think coverage issue blocks this PR, will be good to fix it separately at some point.
* Drop version pinning sqlalchemy and flask_sqlalchemy * Check obj type instead of callable for functions * testing * Adding patch for Session.execute. Removing session.add test * Remove unused variable * Adding 2.0 style test case. Some refactor. Unwrap session. * Splitting out tests * Typo fix * Refactored some tests files * minor renaming of function
Issue #, if available: #281
Description of changes:
For context, please read the following comments:
#281 (comment)
#289 (comment)
#289 (comment)
The changes being done in this PR are:
obj
is of type function.Session.execute
method to capture subsegments for 2.0 style execution introduced in sqlalchemy v1.4.0. And some refactoring of the patch code.tox.ini
for the same.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.