Open whyisdifficult opened 5 months ago
Thanks for the report, @whyisdifficult. ddtrace doesn't directly support connexion
, so I'm not surprised to hear that it has some issues when integrated with connexion and flask. We'll treat this as a request for connexion
support and add it to the backlog. In the meantime, we may be able to suggest some custom code that would work around the issue you're experiencing.
cc @mabdinur
Thanks for the report, @whyisdifficult. ddtrace doesn't directly support
connexion
, so I'm not surprised to hear that it has some issues when integrated with connexion and flask. We'll treat this as a request forconnexion
support and add it to the backlog. In the meantime, we may be able to suggest some custom code that would work around the issue you're experiencing.cc @mabdinur
Thanks @emmettbutler for the response. I have also created a ticket on the Connexion's repo (https://github.com/spec-first/connexion/issues/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:
# Disabled due to issue with log spam
DD_TRACE_STARLETTE_ENABLED=${DD_TRACE_STARLETTE_ENABLED:-false}; export DD_TRACE_STARLETTE_ENABLED
# Also need to disable fastapi as it indirectly enables starlette!
DD_TRACE_FASTAPI_ENABLED=${DD_TRACE_FASTAPI_ENABLED:-false}; export DD_TRACE_FASTAPI_ENABLED
@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
: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 correctlyI 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?