I've set up signoz on my macbook to run a small po...
# support
I've set up signoz on my macbook to run a small poc. I took a basic django app (essentially the polls app in the django tutorial), and while I can successfully get all of the api calls, I'm unable to collect any database calls. I'm using the most recent commit to the signoz repo with docker and clickhouse, and I started my django app with
Copy code
~/src/apm-poc/example> OTEL_RESOURCE_ATTRIBUTES=service.name=example OTEL_EXPORTER_OTLP_ENDPOINT="<>" OTEL_LOG_LEVEL=debug opentelemetry-instrument python3 manage.py runserver --noreload
Performing system checks...

System check identified no issues (0 silenced).
January 10, 2022 - 11:22:20
Django version 4.0.1, using settings 'example.settings'
Starting development server at <>
Quit the server with CONTROL-C.
[10/Jan/2022 11:22:21] "GET /admin/ HTTP/1.1" 302 0
[10/Jan/2022 11:22:21] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 2211
[10/Jan/2022 11:22:26] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
[10/Jan/2022 11:22:26] "GET /admin/ HTTP/1.1" 200 3974
[10/Jan/2022 11:22:26] "GET /static/admin/css/dashboard.css HTTP/1.1" 304 0
[10/Jan/2022 11:22:26] "GET /static/admin/img/icon-addlink.svg HTTP/1.1" 304 0
[10/Jan/2022 11:22:26] "GET /static/admin/img/icon-changelink.svg HTTP/1.1" 304 0
Hi @User are you running the sample Django app we have provided in our repo - https://github.com/SigNoz/sample-django Or are you running some other sample app? Can you try the sample app in our repo and see if it works fine for you? Also, @User do you have more insights on this which would help Mathias?
I was using a different sample app and auto-instrumentation. I'll try using the sample-django from the repo.
I got the same behavior. Traces from the app but not from the database (ie, no selects show up)
Also, I could not get auto-instrumentation working with django unless I added the --noreload flag to the django command, which isn't in the documentation. Am I missing something or do the docs need an update?
how do you run django in production? It is not recommended to run with inbuilt webserver but you should use uwsgi or gunicorn. Also, it is not recommended to run without --no-reload flag as it will hotreload any code changes.
the current example setup is running django with gunicorn, and minor changes will be needed to run with django + uwsgi
I'm unable to collect any database calls
which database do you use? also are you using django orm to do db calls? the name of client libraries for connecting to db will be helpful.
I understand that I wouldn't use runserver in prod, I'm just looking to get it working at all for a poc. In production, depending on application and context, we have it deployed in apache with mod wsgi, or in lambda using zappa, or with uwsgi.
As I noted, I tried using auto-instrumentation with sqllite, postgres, and mysql. None of them worked.
Does auto-instrumentation not work with django? Looking at the gunicorn config, I see that it is executing several opentelemetry methods that are not mentioned in the documentation around instrumenting django.
Using gunicorn, I still see no database calls.
This is the sample django app with gunicorn. Every interaction with a poll should either be calling the database to read or write answers and vote tallies.
Yes, I get this..I don't think opentelemetry auto-instruments the ORM used by django. Though I see
being automatically installed. I have raised an issue with opentelemetry, let me come back when they respond
That would explain it. So instrument by hand or don't get database data. Hmmm.
If using databases through generic ways like https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/sqlite3/sqlite3.html, the db calls get auto-instrumented..but django orm right now does not seem to auto-instrument