-
Notifications
You must be signed in to change notification settings - Fork 626
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
Fixing inescapable character bug for Windows path string #1100
Conversation
Fixes auto-instrumentation not producing spans on Windows. See the following issue: https://github.com/open-telemetry/opentelemetry-python/issues/2703
I expected my PR # to be 1098, but it is apparently 1100. Since this is my first PR, I am not sure how to write the CHANGELOG knowing the PR number that will be created in the future. I can fix the CHANGELOG in another commit |
Co-authored-by: Srikanth Chekuri <[email protected]>
That code block was always broken on Windows, But since it was later in the finally block, it didn't cause an issue every time. The underlying problem is that we passed the re.sub function a raw string, when what it needs is an escaped pattern. This isn't an issue on Linux because linux paths use "/" which do not need to be escaped. But Windows paths use "\" and therefore do need to be escaped. By adding an escape, the string should satisfy re.sub on Linux and Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read what you wrote in #1102 closer and understand 👍 thanks
...etry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py
Outdated
Show resolved
Hide resolved
...etry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py
Outdated
Show resolved
Hide resolved
...etry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py
Outdated
Show resolved
Hide resolved
...etry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py
Outdated
Show resolved
Hide resolved
opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py
Outdated
Show resolved
Hide resolved
Fixed negative look ahead to prevent removing path when it is the only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bearing with me. LGTM!
@jeremydvoss Fix the lint and we are good to merge this. |
Co-authored-by: Srikanth Chekuri <[email protected]>
Co-authored-by: Srikanth Chekuri <[email protected]>
Description
Added an escape call in sitecustomize to fix unescapable character bug in auto-instrumentation on Windows.
Fixes #2703 on opentelemetry-python
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested with server_uninstrumented.py script. Confirmed spans are printed on Windows.
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.