Django app that's auto-instrumented with OTEL Python default distro. Dev mode only; exports telemetry to console.
- Create and activate a virtual environment with Python >= 3.9.
pip install -r requirements.txtexport DJANGO_SETTINGS_MODULE=otel-site.settingscd <repo>/otel-site- You may need to
python manage.py migratethe first time. export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=trueopentelemetry-bootstrap --action=installopentelemetry-instrument --traces_exporter console --metrics_exporter console --logs_exporter console python manage.py runserver --noreload
curl -v http://localhost:8000
curl -v http://localhost:8000/polls
curl -v http://localhost:8000/polls/reentry
In a separate Terminal (same dir, same virtual env, same dependencies), run a request client with python client.py. This triggers distributed OTel trace export to stdout by including OTel context in request to Django (http://localhost:8000/polls).