-
Notifications
You must be signed in to change notification settings - Fork 705
Auto instrumentation is not working #3482
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
Comments
I have hit the same issue while trying to debug auto-instrumentation with an internal non-flask app. Even when explicitly setting arguments via the CLI, I get nothing in either the console or the ❯ python3 --version
Python 3.12.0
❯ opentelemetry-instrument \
--traces_exporter console,otlp \
--metrics_exporter console,otlp \
--service_name your-service-name \
--exporter_otlp_endpoint 127.0.0.1:4317 \
--exporter_otlp_insecure=true \
python3 server_automatic.py
* Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
* Serving Flask app 'server_automatic'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:8082
Press CTRL+C to quit
testing
127.0.0.1 - - [13/Nov/2023 12:43:45] "GET /server_request?param=testing HTTP/1.1" 200 - I do see I was wondering if the 3.12 was breaking things and changed ❯ python3 --version
Python 3.11.6
❯ opentelemetry-instrument --version
opentelemetry-instrument 0.42b0
❯ opentelemetry-instrument \
--traces_exporter console,otlp \
--metrics_exporter console,otlp \
--service_name your-service-name \
--exporter_otlp_endpoint 127.0.0.1:4317 \
--exporter_otlp_insecure=true \
python3 server_automatic.py
* Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
* Serving Flask app 'server_automatic'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:8082
Press CTRL+C to quit
testing
127.0.0.1 - - [13/Nov/2023 13:00:34] "GET /server_request?param=testing HTTP/1.1" 200 - |
+1. The other 2 samples work just fine, but I get nothing on the server console when hitting server_request using automatic instrumentation. |
+1 Seems something have changed auto instrumentation isn't working for me as well. Even FastAPI auto instrumentation is broken. |
I have hit the same issue with opentelemetry-instrumentation 0.42b0. Will it work using 0.41b0? |
I can only make it work with python 3.7 |
The issue appears to be that Flask/Werkzeug 3.0+ is not supported by the auto instrumentation. If you install an older version, then it works as expected: |
Directions can be updated to reflect current state until open-telemetry/opentelemetry-python-contrib#1975 is resolved. |
It's not just Flask, I can't get any ASGI framework auto instrumentation to work; I tried FastAPI, Starlette, plain ASGI. FastAPI example: # app.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"} Run server:
|
Is there any update on this. We are having the same issue as @gsakkis |
I actually have opentelemetry-distro and it still does not work |
I was facing this even with the minimal example and reading the documentation is realized that I had missed this: https://opentelemetry.io/docs/languages/python/automatic/example/#instrumentation-while-debugging Basically on Flask when using This worked for me, I overlooked it. |
@aeb-dev |
@gyliu513 Gentle remind. Any reason to keep the issue open? |
@ijkbytes |
If you use uvicorn with reloading like |
emdneto I think this is still occurring |
We are getting system metrics only if we use reload=true. If we turnoff or remove it works. |
I get by this requirement two years ago and testing again today, opentelemetry-distro is really by opentelemetry-instrument to autoload related instrument libraries. Here are the libraries that I'm using: opentelemetry-api==1.32.1
opentelemetry-distro==0.53b1
opentelemetry-exporter-otlp==1.32.1
opentelemetry-exporter-otlp-proto-common==1.32.1
opentelemetry-exporter-otlp-proto-grpc==1.32.1
opentelemetry-exporter-otlp-proto-http==1.32.1
opentelemetry-exporter-richconsole==0.53b1
opentelemetry-instrumentation==0.53b1
opentelemetry-instrumentation-aiohttp-client==0.53b1
opentelemetry-instrumentation-aiohttp-server==0.53b1
opentelemetry-instrumentation-asyncio==0.53b1
opentelemetry-instrumentation-click==0.53b1
opentelemetry-instrumentation-dbapi==0.53b1
opentelemetry-instrumentation-grpc==0.53b1
opentelemetry-instrumentation-httpx==0.53b1
opentelemetry-instrumentation-logging==0.53b1
opentelemetry-instrumentation-openai-v2==2.1b0
opentelemetry-instrumentation-psycopg2==0.53b1
opentelemetry-instrumentation-requests==0.53b1
opentelemetry-instrumentation-sqlalchemy==0.53b1
opentelemetry-instrumentation-sqlite3==0.53b1
opentelemetry-instrumentation-threading==0.53b1
opentelemetry-instrumentation-tortoiseorm==0.53b1
opentelemetry-instrumentation-urllib==0.53b1
opentelemetry-instrumentation-urllib3==0.53b1
opentelemetry-instrumentation-wsgi==0.53b1
opentelemetry-proto==1.32.1
opentelemetry-sdk==1.32.1
opentelemetry-semantic-conventions==0.53b1
opentelemetry-util-http==0.53b1 |
Following the steps here https://opentelemetry.io/docs/instrumentation/python/automatic/example/#execute-the-automatically-instrumented-server
Run server first
Then run client
Client do have output, but server automatic do not have any output, based on the doc here https://opentelemetry.io/docs/instrumentation/python/automatic/example/#execute-the-automatically-instrumented-server
The text was updated successfully, but these errors were encountered: