Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instrument: moving auto-instrumentation to a submodule #873

Merged

Conversation

toumorokoshi
Copy link
Member

The opentelemetry.instrumentation namespace will be used by
several packages as they become compliant to the opentelemetry specification.

As a result, top-level instrumentations who have a name identical to their
instrumented library (e.g. opentelemetry.instrumentation.requests or
opentelemetry.instrumentation.starlette) will have a cyclic import
error due to opentelemetry-instrument's injection of the
opentelemetry.instrument folder in the path.

Moving auto-instrumentation to a submodule solves this problem, as
the only files in the opentelemetry.instrumentation.auto_instrument
folder is the sitecustomize and the init.py itself.

I ran into this when trying to auto-instrument starlette (imports from module starlette, and Python discovers opentelemetry.instrumentation.starlette.

The opentelemetry.instrumentation namespace will be used by
several packages as they become compliant to the opentelemetry specification.

As a result, top-level instrumentations who have a name identical to their
instrumented library (e.g. opentelemetry.instrumentation.requests or
opentelemetry.instrumentation.starlette) will have a cyclic import
error due to opentelemetry-instrument's injection of the
opentelemetry.instrument folder in the path.

Moving auto-instrumentation to a submodule solves this problem, as
the only files in the opentelemetry.instrumentation.auto_instrument
folder is the sitecustomize and the __init__.py itself.
@toumorokoshi toumorokoshi requested a review from a team June 30, 2020 16:49
@lzchen lzchen merged commit 6ea3f23 into open-telemetry:master Jul 2, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants