dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

aiopg integration is broken

Open wconti27 opened this issue 1 year ago • 2 comments

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?

wconti27 avatar Apr 16 '24 16:04 wconti27

@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.

majorgreys avatar Apr 16 '24 18:04 majorgreys

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

wconti27 avatar Apr 16 '24 18:04 wconti27

This issue has been automatically closed after a period of inactivity. If it's a feature request, it has been added to the maintainers' internal backlog and will be included in an upcoming round of feature prioritization. Please comment or reopen if you think this issue was closed in error.

github-actions[bot] avatar Sep 15 '24 00:09 github-actions[bot]