opentelemetry-python-contrib
opentelemetry-python-contrib copied to clipboard
Remove pkg_resource and replace for importlib.metadata in autoinstrumentation
Description
Pkgresource dependency is deprecated, on this pr i replaced pkg_resource for importlib.metadata.
Fixes https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2180
Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [x] Run with tox the unit tests
Does This PR Require a Core Repo Change?
- [ ] Yes. - Link to PR:
- [x] No.
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
- [x] Followed the style guidelines of this project
- [x] Changelogs have been updated
- [x] Unit tests have been added
- [ ] Documentation has been updated
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: Rodrigo-Novas (070d5669d72c1a122d9b24b77bc719c4bd892c25, 9cae8054e85c9d31565c5347c101d51c1362e1bd, 99502c9c27c54baa2d60051283737c5b1618d6c2, 86f56efc15e14a422373408400f191d5c07c4e98, 1358c12722d43d77df611c679ed0839a5880341c, bf10494c688eb6dae1d3e2b6d381fb6e87f0df12, 9750c8ba06d945fcf9b9cb7297b9c57e0e14fd82, 11926dfcaab8ab63f3d619251e7bd07fae12dcb7, bf4491573e20b06814e1a11feeae2d524c7717e3, 780bcd5298721c9e8e9f612dd35a87ba05007e3c, 2364780d5343b418bb1bc59c71b9260384f4d747)
- :white_check_mark: login: ocelotl / name: Diego Hurtado (8dc274fc876ca7146af8423c3d6044af03559385)
@Rodrigo-Novas please sign the CLA :v:
Is there an expected ETA on this?
I believe this would also fix:
- https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1970
Hope this gets picked back up! Great work so far!
Hey there! Could you prioritize the code review for this PR? It's for migrating to Python 3.12. Thanks a bunch! :D
Any ETA on this?
the package is broken in modern python versions due to undeclared pkg_resources usage.
@Rodrigo-Novas
Are you still working on this? If so we can prioritize getting this reviewed and merged. It is difficult to know what the current status is so please close the conversations that you think have been resolved and note down the open topics that still need to be discussed. Feel free to also join the Python SIG if you want to bring this issue up to the community specifically.
We are also getting hit with this on every unit test run. It would be great to get a fix in.
@Rodrigo-Novas
Are you still working on this? If so we can prioritize getting this reviewed and merged. It is difficult to know what the current status is so please close the conversations that you think have been resolved and note down the open topics that still need to be discussed. Feel free to also join the Python SIG if you want to bring this issue up to the community specifically.
@lzchen
Its ok for me, you can review it!
We are also getting hit with this on every unit test run. It would be great to get a fix in.
i will try to fix it
Switching from pkg_resource to importlib.metadata also helps us to reduce OTEL Python layer Lambda coldstart.
When is this PR expected to be approved and merged?
When is this PR expected to be approved and merged?
When it's ready
When is this PR expected to be approved and merged?
We are trying to get more eyes on this PR, we realize it is important for many people. The issue at hand here is not particularly easy to solve (kudos to @Rodrigo-Novas for the work so far!) since it deals with replacing an old library with a new one where there is not necessarily a 1:1 relationship between old library and new library components. To make matters even more complicated, the new library has been implemented very inconsistently, so its behavior for Python 3.x is not the same as for Python 3.y.
We are working on this and we'll merge as soon as we can :slightly_smiling_face:
For anyone following - this is currently blocked by (at minimum) https://github.com/open-telemetry/opentelemetry-python/pull/4177, as well as a new release needed for https://github.com/open-telemetry/opentelemetry-python/pull/4181 . Some of our assumptions in the previous discussions mentioned need to be re-addressed if we swap to relying on the stdlib in python <= 3.11, which will delay this a bit further.
For anyone following - this is currently blocked by (at minimum) open-telemetry/opentelemetry-python#4177, as well as a new release needed for open-telemetry/opentelemetry-python#4181 . Some of our assumptions in the previous discussions mentioned need to be re-addressed if we swap to relying on the stdlib in python <= 3.11, which will delay this a bit further.
We're keeping importlib_metadata as dependency and PRs run against main of branch of core repo so no need for releases. The current blocker for me is this https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2181#discussion_r1760870946