Skip to content

Commit

Permalink
Prune autoinstrumentation sitecustomize module directory from PYTHONP…
Browse files Browse the repository at this point in the history
…ATH immediately (#1066)
  • Loading branch information
aabmass authored Apr 21, 2022
1 parent 2f7a666 commit c909353
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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()

0 comments on commit c909353

Please sign in to comment.