-
Notifications
You must be signed in to change notification settings - Fork 415
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
Connexion v3, Flask v3 integration with dd-trace fails: datadog context not present in ASGI request scope, trace middleware may be missing #9628
Comments
Thanks for the report, @whyisdifficult. ddtrace doesn't directly support cc @mabdinur |
Thanks @emmettbutler for the response. I have also created a ticket on the Connexion's repo (spec-first/connexion#1945) as I wasn't sure were the error originates. We would really appreciate if you guys have a temporary workaround for this as we would like to upgrade our applications with the latest versions of these libs. |
Hello guys, have you had the chance to look into this further to explore a possible (temporary) workaround for this issue?Thanks for the efforts. @emmettbutler @mabdinur |
Any updates on this? @emmettbutler @mabdinur Thanks. |
Had a similar issue with python-socketio when used with fastapi. Disabled starlette integration altogether by setting two variables:
@whyisdifficult you may need to play around with what to disable, since we are using fastapi in place of flask. |
Summary of problem
Running the latest version of the Connexion framework with a Flask application I get the following warning while trying to log messages to Datadog:
datadog context not present in ASGI request scope, trace middleware may be missing
This warning effectively means that we don't have tracing enabled for our application.
Which version of dd-trace-py are you using?
ddtrace==2.9.2
Which version of pip are you using?
pip=24.0
poetry==1.7.1
Which libraries and their versions are you using?
The most important and relevant would be these:
How can we reproduce your problem?
We create the application as follows:
Then, the application runs via
docker-compose
:CMD ["gunicorn", "-c", "gunicorn.conf.py", "-k", "uvicorn.workers.UvicornWorker", "myproject.__main__:create_app()"]
This was not happening when we were using the previous version of Connexion (
connexion = "2.14.2"
), Flask and dd-trace (ddtrace = "2.7.3"
)Solutions Tried
One of the many things I have tried was to use the
TraceMiddleware
as follows and, patching the application in different places.Via the logs I can see that
starlette
has been patched correctlyConfigured ddtrace instrumentation for 59 integration(s). The following modules have been patched: aioredis,aiomysql,aredis,asyncio,boto,botocore,bottle,cassandra,celery,consul,django,dramatiq,elasticsearch,algoliasearch,futures,gevent,graphql,grpc,httpx,kafka,mongoengine,mysql,mysqldb,pymysql,mariadb,psycopg,pylibmc,pymemcache,pymongo,redis,rediscluster,requests,rq,sanic,sqlite3,aiohttp,aiohttp_jinja2,aiopg,vertica,molten,jinja2,mako,flask,flask_login,starlette,falcon,pyramid,logging,pynamodb,pyodbc,fastapi,dogpile_cache,yaaredis,asyncpg,aws_lambda,openai,langchain,subprocess,unittest
I have followed the docs for dd-trace integration but I still can't make it work.
The application does work well. Meaning that I'm able to make requests to the API it implements.
What is the result that you get?
We get the following warning and DD traces are disabled.
What is the result that you expected?
We expect the application to be able to log messages to DD with traces enabled.
Does anyone else have run into the same issue? If so, what do you propose as a solution to this?
The text was updated successfully, but these errors were encountered: