We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fe1f47 commit 21007ccCopy full SHA for 21007cc
opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py
@@ -15,6 +15,8 @@
15
import sys
16
from logging import getLogger
17
from os import environ, path
18
+from os.path import abspath, dirname, pathsep
19
+from re import sub
20
21
from pkg_resources import iter_entry_points
22
@@ -83,6 +85,12 @@ def initialize():
83
85
_load_instrumentors()
84
86
except Exception: # pylint: disable=broad-except
87
logger.exception("Failed to auto initialize opentelemetry")
88
+ finally:
89
+ environ["PYTHONPATH"] = sub(
90
+ r"{}{}?".format(dirname(abspath(__file__)), pathsep),
91
+ "",
92
+ environ["PYTHONPATH"],
93
+ )
94
95
96
if (
0 commit comments