-
Notifications
You must be signed in to change notification settings - Fork 614
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
Fix psycopg2 instrument issue #2795
base: main
Are you sure you want to change the base?
Fix psycopg2 instrument issue #2795
Conversation
Signed-off-by: Qiu, David <[email protected]>
...pentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py
Show resolved
Hide resolved
Signed-off-by: Qiu, David <[email protected]>
Signed-off-by: Qiu, David <[email protected]>
Signed-off-by: Qiu, David <[email protected]>
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 this is missing a test showing what is currently not working
Thanks for your suggestion, I will add a test case for it. |
|
instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_integration.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Qiu, David <[email protected]>
Signed-off-by: Qiu, David <[email protected]>
connection._is_instrumented_by_opentelemetry = True | ||
else: | ||
def instrument_connection(self, connection, tracer_provider=None): | ||
if isinstance(connection, ObjectProxy): |
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'm still not sure this solves the original issue (we still don't know WHY the error is being generated when we are trying to access _is_instrumented_by_opentelemetry
field but this current change is fine as a short-term solution. Please add a TODO or follow-up issue to investigate.
Please allow for maintainer edits so we can rebase for you. |
Hi @qiuge615 are you still working on this PR? |
Description
Currently there is issue with psycopg2, the instrumentation can not work as expected. Update the codes based on mysql and sqlite3 to resolve the issue. Will check the two properties _otel_orig_cursor_factory and _is_instrumented_by_opentelemetry in subsequent issue later.
Fix one issue in unit test, assign instrumented connection to cnx.
Fixes #2522
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested with below command to run unit test
tox -e py310-test-opentelemetry-instrumentation-psycopg2
Tested traces with local environment and the traces are displayed without error.
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.