Python Instrumentation in Containers
Instrumentation of Python applications in containers with the OpenTelemetry agent
Agent installation in the Dockerfile
Common packages (always install):
RUN pip install \
opentelemetry-distro \
opentelemetry-exporter-otlp \
opentelemetry-instrumentation-requestsFastAPI:
RUN pip install opentelemetry-instrumentation-fastapiFlask:
RUN pip install opentelemetry-instrumentation-flaskDjango:
RUN pip install opentelemetry-instrumentation-djangoExample Dockerfile:
Environment Variables Configuration
Explanation:
How to start the app with the agent (CMD)
FastAPI (with Uvicorn)
Flask
Django
Examples by Environment
Docker Compose
Kubernetes
ECS (Fargate ou EC2)
Troubleshooting
Best Practices
Example of .env
.envLast updated
Was this helpful?

