-
Notifications
You must be signed in to change notification settings - Fork 642
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
Prune autoinstrumentation sitecustomize module directory from PYTHONPATH immediately #1066
Conversation
eebab9a
to
697054c
Compare
This PR broke auto-instrumentation for me. the server-uninstrumented.py script fails to produce spans. Could you explain the purposed of moving the code block out of "finally"? Here's a seemingly related issue. |
Check the PR description and #1050. Can you provide a repro in a new issue? It is working fine for me: $ python3 -m venv venv
$ source venv/bin/activate
$ pip install flask opentelemetry-instrumentation opentelemetry-distro opentelemetry-instrumentation-flask
$ curl -O https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/main/docs/examples/auto-instrumentation/server_uninstrumented.py
$ opentelemetry-instrument --traces_exporter console python server_uninstrumented.py
# separate terminal do
$ curl localhost:8082/server_request
* Serving Flask app 'server_uninstrumented' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
None
{
"name": "/server_request",
"context": {
"trace_id": "0x036a62b07231c51c2cd9fb8db5d8de0b",
"span_id": "0x46378b949ea3c0fb",
"trace_state": "[]"
},
"kind": "SpanKind.SERVER",
"parent_id": null,
"start_time": "2022-05-19T03:18:34.192093Z",
"end_time": "2022-05-19T03:18:34.193532Z",
"status": {
"status_code": "UNSET"
},
"attributes": {
"http.method": "GET",
"http.server_name": "127.0.0.1",
"http.scheme": "http",
"net.host.port": 8082,
"http.host": "localhost:8082",
"http.target": "/server_request",
"net.peer.ip": "127.0.0.1",
"http.user_agent": "curl/7.82.0",
"net.peer.port": 33810,
"http.flavor": "1.1",
"http.route": "/server_request",
"http.status_code": 200
},
"events": [],
"links": [],
"resource": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.12.0rc1",
"telemetry.auto.version": "0.31b0",
"service.name": "unknown_service"
}
} |
Here are my results running with the 1066 change. I am on Windows 11:
However, when I comment out the code block and put it back in the finally, I get the full span:
Notice that in both cases I get, this strange |
Description
This prevents auto-instrumentation of subprocesses launched with
exec*
as soon as possible. The risk of autoinstrumenting these subprocesses is creating a loop of autoinstrumentation if the initialization code creates the subprocess.Fixes #1050
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Tested manually
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.