Skip to content

Opentelemetry instrumentation uses deprecated pkg_resources. #1970

Closed
@jenshnielsen

Description

@jenshnielsen

Describe your environment
Python 3.11
Setuptools >= 67.5.0
Windows 11

Steps to reproduce

Any operation that imports opentelemetry\instrumentation\dependencies.py

What is the expected behavior?

No deprecation warnings

What is the actual behavior?
What did you see instead?

C:\Users\jenielse\Miniconda3\envs\myenv\Lib\site-packages\opentelemetry\instrumentation\dependencies.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

Additional context

This was removed from opentelemetry sdk/api in open-telemetry/opentelemetry-python#3047

In addition to being deprecated pkg_resources is known to be problematic since it indexes all packages on start up adding significant overhead to the package import. Normally this should be replaced by importlib.resources or for older python version support importlib_resources

As a bonus this will also remove the runtime dependency on setuptools

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions