open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
649 stars 536 forks source link

Auto instrumentation issues in Python 3.12 #2100

Open bourbonkk opened 6 months ago

bourbonkk commented 6 months ago

Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.

Is your feature request related to a problem? If so, provide a concise description of the problem.

As you may have noticed, it's been a while since Python 3.12 was released. In Python 3.12, the pkg_resources package was removed.

As a result, I don't think the auto-instrumentation feature in 3.12 will work with it. If you look at the dependencies.py, it uses pkg_resources to validate supported versions.

I think we need to change to a versioning logic that will be compatible in 3.12. Are there any ideas being discussed on this?

Describe the solution you'd like What do you want to happen instead? What is the expected behavior?

auto instrumentation in python 3.12

Describe alternatives you've considered Which alternative solutions or features have you considered?

I thought about checking the version with the importlib package. But to compare versions using strings like "flask >= 1.0, < 3.0",
it need a development parsing class (it was able to do this with the pkg_resources package).

And we need to modify the DependencyConflict class to make it universally usable - there is no VersionConflict exception in importlib, all exceptions are PackageNotFoundError.

Additional context Add any other context about the feature request here.

If you have something in mind, please share. Python 3.12 has a lot of changes, so I suspect it will probably grow in users quickly.

andre-meneses-fivestars commented 3 months ago

I believe this PR: https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2181 would solve this

andre-meneses-fivestars commented 1 month ago

@bourbonkk why close if the linked PR is not merged?

bourbonkk commented 1 month ago

@andre-meneses-fivestars oh i'm sorry, I misunderstood.