dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

ddtrace 2.7.2 - issues with Flask and SQLAlchemy

Open hdadkhah1 opened this issue 11 months ago • 3 comments

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.

hdadkhah1 avatar Mar 12 '24 05:03 hdadkhah1

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?

gnufede avatar Mar 12 '24 08:03 gnufede

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 image

kkonstant-in avatar Mar 14 '24 05:03 kkonstant-in

Hey @hdadkhah1,

Thanks for opening this issue.

  1. 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.
  2. What version of postgres and sqlalchmy are you using. Would you be able to share the full output of your pip freeze?
  3. Can you share your sampling configurations? For example are you configuring single span or service based sampling?
  4. 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.
  5. 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.
  6. 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(...) OR span = tracer.start_span() and you DO NOT call span.finish() then that span and all of it's child spans MAY NOT be sent to the agent.
  7. 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.
  8. 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?

mabdinur avatar Mar 14 '24 13:03 mabdinur

upgraded to 2.7.3 and it seems to be working well!

hdadkhah1 avatar Mar 17 '24 23:03 hdadkhah1