Skip to content
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

aiopg integration is broken #9003

Open
wconti27 opened this issue Apr 16, 2024 · 2 comments
Open

aiopg integration is broken #9003

wconti27 opened this issue Apr 16, 2024 · 2 comments

Comments

@wconti27
Copy link
Contributor

wconti27 commented Apr 16, 2024

As far as I can tell, the aiopg integration is broken. Testing does not run properly due to the pytest.mark.asyncio method decorator. Once replaced by the mark_asyncio decorator, tests do run, but fail due to problems with the patch. Also, aiopg.connect is not patched correctly (only aiopg.connection.connect is patched)

Summary of problem

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/william.conti/Documents/dd-trace/dd-trace-py/_aiopg.py", line 95, in
loop.run_until_complete(go_patched())
File "/Users/william.conti/.pyenv/versions/3.11.3/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/william.conti/Documents/dd-trace/dd-trace-py/ddtrace/contrib/asyncio/patch.py", line 50, in traced_coro
return await coro
^^^^^^^^^^
File "/Users/william.conti/Documents/dd-trace/dd-trace-py/_aiopg.py", line 56, in go_patched
async with conn.cursor() as cur:
^^^^^^^^^^^^^
File "/Users/william.conti/Documents/dd-trace/dd-trace-py/ddtrace/contrib/aiopg/connection.py", line 103, in cursor
self.close_cursor()
^^^^^^^^^^^^^^^^^
AttributeError: 'Connection' object has no attribute 'close_cursor'

Which version of dd-trace-py are you using?

most recent pull of main

Which version of pip are you using?

Which libraries and their versions are you using?

`pip freeze`

How can we reproduce your problem?

What is the result that you get?

What is the result that you expected?

@majorgreys
Copy link
Collaborator

majorgreys commented Apr 16, 2024

@wconti27 Can you add the test error from the failed run?

As an aside, it'd be also useful to validate the integration is broken with a sample app. Put another way, we want to know if its the integration patch or the integration's tests that are broken.

@wconti27
Copy link
Contributor Author

Sample app branch: conti/debug-aiopg

The sample app has two functions, the first is untraced (though it should be traced, but aiopg.connect is not correctly patched). The second function uses aiopg.connection.connect, and results in tracing, but conn.cursor fails since no conn.close_cursor() exists for aiopg.

pip install .
docker-compose up -d postgres
python -m _aiopg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants