dd-trace-py
dd-trace-py copied to clipboard
ddtrace 2.7.2 - issues with Flask and SQLAlchemy
Summary of problem
After upgrading to ddtrace 2.7.2 all trace correlations are missing from datadog, and they are showing up as individual spans. No more Postgres and Reds tracing showing up under root spans.
Which version of dd-trace-py are you using?
ddtrace = "^2.7.2"
Which version of pip are you using?
pip3
Which libraries and their versions are you using?
flask = "~2.2.5" flask-babel = "^3.1.0" flask-caching = "^2.0.2" flask-cors = "^3.0.10" flask-marshmallow = ">=0.14.0,<0.15.0" flask-migrate = "^2.6.0" flask-restx = "^1.0.2" flask-script = "^2.0.6" flask-shell-ipython = ">=0.4.1,<0.5.0" flask-sqlalchemy = "3.0.5"
What is the result that you get?
Spans are empty often and missing redis and postgres traces in the span.
What is the result that you expected?
Seeing those missing traces.
Hi @hdadkhah1, thank you for reporting this issue.
Can you confirm that 2.7.1 doesn't show this behavior? Or what version are you upgrading from?
Traces stopped working for us after unrelated upgrade.
Just tried to downgrade from the latest tracer back to v2.7.1 and you can see the result in the screenshot below
Hey @hdadkhah1,
Thanks for opening this issue.
- What version of ddtrace did you upgrade from? Did you see the same behavior with v2.7.0 OR or v2.6.X? This information will help us isolate this behavior to a single release.
- What version of postgres and sqlalchmy are you using. Would you be able to share the full output of your
pip freeze
? - Can you share your sampling configurations? For example are you configuring single span or service based sampling?
- In your Datadog account are you missing expected redis and database spans or are these spans being sent as root spans? This will help us determine if this is a sampling issue or a span parenting issue.
- Are your flask, postgres, and/or redis db spans generated on the same host (and in the same process)? This will help us isolate this issue to distributed tracing headers and trace context propagation.
- Are you using any manual tracing in your application (ex: are you creating your own custom spans)? A Span is (usually) sent to the agent after all parent spans are finished. For example If you're creating a span in your application via (
span = tracer.trace(...)
ORspan = tracer.start_span()
and you DO NOT callspan.finish()
then that span and all of it's child spans MAY NOT be sent to the agent. - Can you open a support ticket at https://help.datadoghq.com/hc/en-us/requests/new? This will allow our support team to access your Datadog Org and collect diagnostic data. Feel free to link this github issue in the support ticket.
- I tried to create a test application using flask, redis, postgres and sqlalchemy and I was not able to reproduce this behavior. Would you be to share a simple produceable example?
upgraded to 2.7.3 and it seems to be working well!