opentelemetry-python
opentelemetry-python copied to clipboard
Django gunicorn auto instrumentation
Currently, Django autoinstrumentation supports flask and uWSGI servers. However, when running django app using gunicorn server, the autoinstrumentation does not work.
This is the command I am trying to run.
opentelemetry-instrument --trace-exporter zipkin_json python3.8 gunicorn ${DJANGO_WSGI_MODULE}:application --name ${NAME} --bind=127.0.0.1:80 --preload
The app starts fine, but doesn't report any traces to zipkin.
It is not supported by the opentelemetry-instrument command. Docs mention it and explain how to instrument gunicorn based services: https://opentelemetry-python.readthedocs.io/en/latest/examples/fork-process-model/README.html?highlight=gunicorn#working-with-fork-process-models
I'd like to leave this open in the hope of adding native support for gunicorn to the opentelemetry-instrument command.
AFAIK, even the post_fork hook
doesn't work with auto-instrumentation using the way it is explained in the docs. The doc explains manual way of instrumenting. Probably we can update the docs to explain how to auto-instrument
guincorn based services as well.
we need to add the following to initialize auto-instrumentation
from opentelemetry.instrumentation.auto_instrumentation import sitecustomize
in the post_fork
method.
I remember using Gunicorn with auto instrumentation and see it emit traces while debugging some issue.
Any update on this making to the next version.
Does open-telemetry support manual instrumentation for Gunicorn then?