DataDog / dd-trace-py

Datadog Python APM Client
https://ddtrace.readthedocs.io/
Other
519 stars 407 forks source link

SQLModel #3904

Closed fredrikaverpil closed 2 years ago

fredrikaverpil commented 2 years ago

Hi! 👋

I am interested in knowing how SQLModel would work (or not) with automatic tracing (when wrapping your app in ddtrace-run). Since it's using SQLAlchemy under the hood (which is compatible with ddtrace), I'm assuming queries done with SQLModel would be automatically picked up?

Am I right? 😄

Kyle-Verhoog commented 2 years ago

hey @fredrikaverpil!

If SQLModel is depending on and using SQLAlchemy under the hood then spans should be produced for the queries, yes.

It might be possible that SQLModel is using lower level elements in SQLAlchemy that might miss our instrumentation points. It looks like our SQLAlchemy integration simply wraps create_engine which it appears SQLModel doesn't use, so at a glance it looks like no data would be produced.

However, if the libraries are similar enough then reusing the patching for create_engine might work with SQLModel too. Feel free to try that and report back, otherwise we'd have to look at adding support for SQLModel. 🙂

fredrikaverpil commented 2 years ago

Okay, great - thanks @Kyle-Verhoog!

If queries are not automatically picked up, I could still resort to using tracer.wrap() right?

I think we can close this issue for now, as I am about to go on vacation but could look into this in August and will report back in this thread. Not worth leaving an open issue for this though 😄 .

brettlangdon commented 2 years ago

@fredrikaverpil per your request I'll close this issue, but please do report back in August!