Skip to content
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

Django ORM auto-instrumentation support #856

Open
ankitnayan opened this issue Jan 11, 2022 · 6 comments
Open

Django ORM auto-instrumentation support #856

ankitnayan opened this issue Jan 11, 2022 · 6 comments

Comments

@ankitnayan
Copy link

ankitnayan commented Jan 11, 2022

Does opentelemetry auto-instrument Django ORM database calls? Since, most of the Django users use the in-built ORM, it would be very useful to extend DB instrumentation to ORM. When I run opentelemetry-bootstrap , I can see opentelemetry-instrumentation-sqlite3 as one of the values, so opentelemetry should be auto-instrumenting DB calls made.

@ankitnayan ankitnayan added the bug Something isn't working label Jan 11, 2022
@srikanthccv srikanthccv added feature-request instrumentation and removed bug Something isn't working labels Jan 11, 2022
@phillipuniverse
Copy link
Contributor

This is available not as Django ORM instrumentation but for the particular underlying database driver. For instance opentelemetry-instrumentation-psycopg2 for Postgres, opentelemetry-instrumentation-pymysql for MySQL, the SQLite one you already mentioned, etc.

For postgres specifically you might run into #610 if you are using psycopg2-binary.

@owais
Copy link
Contributor

owais commented Jan 11, 2022

We have instrumentation for individual DB drivers like @phillipuniverse said but I don't see why we the existing Django instrumentation cannot cover the ORM as well. Might be useful to have for additional insight or use with DB backends we don't have instrumentation for.

@ankitnayan
Copy link
Author

We have instrumentation for individual DB drivers like @phillipuniverse said but I don't see why we the existing Django instrumentation cannot cover the ORM as well. Might be useful to have for additional insight or use with DB backends we don't have instrumentation for.

Right, and I think django ORM is heavily used by teams working on django. Not having db spans in trace will leave a huge gap on instrumentation.

@ocelotl
Copy link
Contributor

ocelotl commented Jan 18, 2022

Is this an issue to track the addition of ORM auto-instrumentation support in Django? If so, please update the description and title, @ankitnayan ✌️

@owais owais added the help wanted Extra attention is needed label Jan 26, 2022
@tylerstar
Copy link

auto-instrumentation already supports django orm (django version == 4.2.2), at least works for me

@mlakewood
Copy link

mlakewood commented Mar 30, 2024

@tylerstar could you elaborate? Is there any other settings you needed to enable? Which version of the auto instumenter were you using etc? I can't see in the django instrumentor code where this would get hooked into the ORM. And im only seeing request level spans come through from my django 4.2 app.

Is it by enabling the sql_commentor flag? I wasnt super sure what that did?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants