Open alexmojaki opened 6 months ago
@alexmojaki would be great if you can open a PR
@xrmx regarding this issue, shall I reference mysql/sqlite3 to fix this issue? Tested this approach locally, the instrument works and the trace can be displayed. Shall I create another issue to add the two parameters _otel_orig_cursor_factory and _is_instrumented_by_opentelemetry in connection object? The same approach may applies for psycopg.
@qiuge615 If you have already some code open a PR so we can discuss looking at it :) Thanks!
@xrmx Appreciate your quick reply, I will create a PR with the changes, thank you!
@xrmx Created PR with the fix, please review, thanks.
Describe your environment
Steps to reproduce
Use
Psycopg2Instrumentor().instrument_connection
. For example:and run a database with:
What is the actual behavior?
Additional context
Here's where the error happens:
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/46d2ce6acea9a1a6cb1a4d4c863077002f5f7d21/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py#L164
The code seems tested here:
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/46d2ce6acea9a1a6cb1a4d4c863077002f5f7d21/instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_integration.py#L210
but it doesn't get the error because it's a mock connection.