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

Prune autoinstrumentation sitecustomize module directory from PYTHONPATH immediately #1066

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.0-0.30b0...HEAD)

- Prune autoinstrumentation sitecustomize module directory from PYTHONPATH immediately
([#1066](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1066))

## [1.11.0-0.30b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.11.0-0.30b0) - 2022-04-18

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,20 @@ def _load_configurators():


def initialize():
# prevents auto-instrumentation of subprocesses if code execs another python process
environ["PYTHONPATH"] = sub(
rf"{dirname(abspath(__file__))}{pathsep}?",
"",
environ["PYTHONPATH"],
)

try:
distro = _load_distros()
distro.configure()
_load_configurators()
_load_instrumentors(distro)
except Exception: # pylint: disable=broad-except
logger.exception("Failed to auto initialize opentelemetry")
finally:
environ["PYTHONPATH"] = sub(
rf"{dirname(abspath(__file__))}{pathsep}?",
"",
environ["PYTHONPATH"],
)


initialize()