Is opentelemetry-instrument with django expected t...
# support
d
Is opentelemetry-instrument with django expected to only record web requests with no breakdown of function calls nor DB calls? I'm using the automatic instrumentation run command as described [here](https://signoz.io/docs/instrumentation/python#instrumenting-django-applications). Is there any way to get more information? See example Trace. I also tried the django-sample but I was unable to get it working. Nothing shows up when trying a Python virtual environment without Docker. The docker image for it appears to not support x86. There is also a typo on the readme
Copy code
signoz/sample-django:latest1
there should not be a 1. In addition, it is not safe to assume
Copy code
host.docker.internal
will resolve, though fixing these issues results in an message about not having the x86 image. I do not have any arm hardware to test on.
p
@User Which database are you using in your application?
DB calls should show up in the traces if the database you are using is supported by opentelemetry python. @User do you have more insights on this ? I will update the typo on readme
d
I'm using Postgres. I see there is a psycopg2 opentelemetry package but it doesn't seem to work. I ensured opentelemetry-instrumentation-psycopg2 was installed.
👍 1
p
do you use psycopg2 to connect with postgres from python?
d
I let Django ORM set this, but it internally uses psycopg2 https://docs.djangoproject.com/en/4.0/ref/databases/#postgresql-notes
p
I see. can you share your requirements.txt for this app? Will have to check this if Django ORM is supported
d
Django 4.0.2 opentelemetry-api 1.9.1 opentelemetry-distro 0.28b1 opentelemetry-exporter-otlp 1.9.1 opentelemetry-exporter-otlp-proto-grpc 1.9.1 opentelemetry-exporter-otlp-proto-http 1.9.1 opentelemetry-instrumentation 0.28b1 opentelemetry-instrumentation-dbapi 0.28b1 opentelemetry-instrumentation-django 0.28b1 opentelemetry-instrumentation-psycopg2 0.28b1 opentelemetry-instrumentation-wsgi 0.28b1 opentelemetry-propagator-jaeger 1.9.1 opentelemetry-proto 1.9.1 opentelemetry-sdk 1.9.1 opentelemetry-semantic-conventions 0.28b1 opentelemetry-util-http 0.28b1 psycopg2-binary 2.9.3
Relevant issue, but I'm not sure if there is a way to manually set the integration. https://github.com/open-telemetry/opentelemetry-python-contrib/issues/856
p
Can you use
psycopg2
instead of
psycopg2-binary
the later is non-production setup and is not supported by otel instrumentation? If you use postgres/ mysql/ sqlite3 as engine in django ORM, you should be able to see data
d
ah that was it, thank you!
p
are you able to see DB call data now?
d
Yes I am
p
nice 🙌
s
Glad you were able to figure this out. The reason we don't support the
psycopg2-binary
is that the official docs don't recommend it for the production use and we don't want to add instrumentation for the non-production ready libs. https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary
💯 1