Skip to content

instrument: moving auto-instrumentation to a submodule#873

Merged
lzchen merged 2 commits intoopen-telemetry:masterfrom
toumorokoshi:feature/move-auto-instrumentation
Jul 2, 2020
Merged

instrument: moving auto-instrumentation to a submodule#873
lzchen merged 2 commits intoopen-telemetry:masterfrom
toumorokoshi:feature/move-auto-instrumentation

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