openllmetry
openllmetry copied to clipboard
🐛 Bug Report: AttributeError on import of newer version of traceloop.sdk
Which component is this bug for?
Traceloop SDK
📜 Description
The installed_packages in packages/traceloop-sdk/traceloop/sdk/utils/package_check.py assuming that every distribution's metadata contains a "Name" entry. If a distribution's metadata is missing this entry (or if it is None), attempting to call .lower() on None will result in an AttributeError. This error was not present in older versions of traceloop-sdk and started happening when upgrading to version 34 and above
👟 Reproduction steps
from traceloop.sdk import Instruments
👍 Expected behavior
installed_packages = {
dist.metadata.get("Name", "").lower()
for dist in distributions()
if dist.metadata.get("Name") is not None
}
👎 Actual Behavior with Screenshots
File "/app/venv/lib/python3.11/site-packages/traceloop/sdk/utils/package_check.py", line 3, in <setcomp>
installed_packages = {dist.metadata["Name"].lower() for dist in distributions()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'
🤖 Python Version
3.11
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- [x] I checked and didn't find similar issue
Are you willing to submit PR?
None
Fixed by #2607