Skip to content

Commit ea0cf3f

Browse files
committed
Adding escape call to sitecustomize sub call.
Fixes auto-instrumentation not producing spans on Windows. See the following issue: https://github.com/open-telemetry/opentelemetry-python/issues/2703
1 parent 10659f8 commit ea0cf3f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.12.0rc1-0.31b0...HEAD)
99

10+
- Adding escape call to fix [auto-instrumentation not producing spans on Windows](https://github.com/open-telemetry/opentelemetry-python/issues/2703).
11+
([#<PR>](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/<PR>))
12+
1013
## [1.12.0rc1-0.31b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc1-0.31b0) - 2022-05-17
1114

1215

opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from logging import getLogger
1616
from os import environ
1717
from os.path import abspath, dirname, pathsep
18-
from re import sub
18+
from re import sub, escape
1919

2020
from pkg_resources import iter_entry_points
2121

@@ -112,7 +112,7 @@ def _load_configurators():
112112
def initialize():
113113
# prevents auto-instrumentation of subprocesses if code execs another python process
114114
environ["PYTHONPATH"] = sub(
115-
rf"{dirname(abspath(__file__))}{pathsep}?",
115+
escape(rf"{dirname(abspath(__file__))}{pathsep}?"),
116116
"",
117117
environ["PYTHONPATH"],
118118
)

0 commit comments

Comments
 (0)