dynatrace-oss / OneAgent-SDK-Python-AutoInstrumentation

autodynatrace, a python library that implements automatic instrumentation using the OneAgent SDK for Python
Other
62 stars 28 forks source link

Error on aiohttp wrapper #69

Closed murias-coppel closed 1 year ago

murias-coppel commented 1 year ago

In the autodynatrace - aiohttp integration, when any request is made the wrapper is throwing the following exception:

File "python3.11/site-packages/aiohttp/client.py", line 1141, in __aenter__ self._resp = await self._coro File "python3.11/site-packages/autodynatrace/wrappers/aiohttp/wrapper.py", line 21, in dynatrace_request tag = tracer.outgoing_dynatrace_string_tag.decode() AttributeError: 'str' object has no attribute 'decode'

Maybe a possible solution could be to change line 18 in the autodynatrace/wrappers/aiohttp/wrapper.py file to: tag = tracer.outgoing_dynatrace_byte_tag.decode()

dlopes7 commented 1 year ago

An easy fix, pin oneagent-sdk==1.4.0, there are breaking changes in 1.5.0

We will release a new version in the future that is compatible with 1.5.0

Oberon00 commented 1 year ago

Hi, I could not reproduce this problem with the 1.5 SDK, and there should not be any breaking changes in 1.5. Can you provide more information about your situation? Which SDK version are you actually using that has this problem? What does oneagent.initialize() (probably automatically called here) log/return?

If there is actually an unintentional breaking change in 1.5 (i.e., a bug) that I failed to notice, please let me know so I can fix it over in the SDK

murias-coppel commented 1 year ago

Hi, thanks for your reply, I am using the following versions:

oneagent-sdk==1.4.0.20210127.165413 autodynatrace==1.0.86 aiohttp==3.8.3

with python 3.11. And the initializer, I get the message "init: Could not initialize the OneAgent SDK, AgentState: 3".

dlopes7 commented 1 year ago

This is a different error where the OA libraries were not found and you can troubleshoot by following the documentation here: https://github.com/Dynatrace/OneAgent-SDK-for-Python#troubleshooting

dlopes7 commented 1 year ago

Like @Oberon00 commented, I made a mistake, there is no breaking change and I can't reproduce either, I also get a byte string every time. Please post a minimal example to reproduce the original issue, if you are past it and is now hitting the Agent State 3 check the link shared .