opentelemetry-python-contrib
opentelemetry-python-contrib copied to clipboard
Fix psycopg2 instrument issue
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.
- [x] Bug fix (non-breaking change which fixes an issue)
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?
- [ ] Yes. - Link to PR:
- [x] No.
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
- [x] Followed the style guidelines of this project
- [ ] Changelogs have been updated
- [ ] Unit tests have been added
- [ ] Documentation has been updated