observability-edot-python-instrument
elastic/agent-skills
Instrument Python apps with Elastic Distribution of OpenTelemetry for automatic tracing, metrics, and logs.
What is observability-edot-python-instrument?
Adds automatic observability to Python services using EDOT Python agent. Use this when you need tracing, metrics, and log collection without modifying application code. Requires setting environment variables and wrapping the application entrypoint.
- Automatic distributed tracing of Python applications
- Collects metrics from instrumented libraries
- Gathers structured logs alongside traces
- Auto-detects and instruments popular Python frameworks and libraries
- Exports telemetry to Elastic managed OTLP endpoints or EDOT Collector
- Zero-code instrumentation via opentelemetry-instrument wrapper
How to install observability-edot-python-instrument
npx skills add https://github.com/elastic/agent-skills --skill observability-edot-python-instrument- Python application with pip package management
- Access to Elastic managed OTLP endpoint or EDOT Collector URL
- Valid API key or bearer token for authentication
- Docker or container build environment (for edot-bootstrap installation)
How to use observability-edot-python-instrument
- 1.Add `elastic-opentelemetry` to your requirements.txt or equivalent dependency file
- 2.Run `edot-bootstrap --action=install` during your container image build to auto-install instrumentation packages
- 3.Wrap your application entrypoint with `opentelemetry-instrument` (e.g., `opentelemetry-instrument gunicorn app:app`)
- 4.Set three required environment variables: `OTEL_SERVICE_NAME`, `OTEL_EXPORTER_OTLP_ENDPOINT` (managed OTLP endpoint URL), and `OTEL_EXPORTER_OTLP_HEADERS` with authorization
- 5.Deploy and verify telemetry is flowing to your Elastic cluster
Use cases
- Adding observability to a new Python microservice before deployment
- Instrumenting existing Python applications without code changes
- Collecting traces and metrics from Django, Flask, FastAPI, or other WSGI/ASGI applications
- Monitoring Python background workers or scheduled tasks
- Exporting telemetry to Elastic Cloud or self-managed Elasticsearch clusters
- Python backend developers
- DevOps engineers setting up observability
- SREs monitoring Python services
- Teams migrating from classic Elastic APM to OpenTelemetry
observability-edot-python-instrument FAQ
No. The `opentelemetry-instrument` wrapper handles all instrumentation automatically. Do not add code-level SDK setup like TracerProvider or configure_azure_monitor.
Use the managed OTLP endpoint or EDOT Collector URL provided by Elastic. Never use an APM Server URL (no apm-server, no :8200, no /intake/v2/events).
No. Never run both classic `elastic-apm` and EDOT on the same application. Choose one or the other.
Do not set these variables. The defaults are already correct for EDOT and will be overridden if you set them.
EDOT auto-instruments popular frameworks including Django, Flask, FastAPI, and other WSGI/ASGI applications. Run `edot-bootstrap --action=install` to detect and install instrumentation for your specific libraries.
Full instructions (SKILL.md)
Source of truth, from elastic/agent-skills.
name: observability-edot-python-instrument description: > Instrument a Python application with the Elastic Distribution of OpenTelemetry (EDOT) Python agent for automatic tracing, metrics, and logs. Use when adding observability to a Python service that has no existing APM agent. metadata: author: elastic version: 0.1.0
EDOT Python Instrumentation
Read the setup guide before making changes:
Guidelines
- Install
elastic-opentelemetryvia pip (add torequirements.txtor equivalent) - Run
edot-bootstrap --action=installduring image build to install auto-instrumentation packages for detected libraries - Wrap the application entrypoint with
opentelemetry-instrument— e.g.opentelemetry-instrument gunicorn app:apporopentelemetry-instrument python app.py. Without this, no telemetry is collected - Set exactly three required environment variables:
OTEL_SERVICE_NAMEOTEL_EXPORTER_OTLP_ENDPOINT— must be the managed OTLP endpoint or EDOT Collector URL. Never use an APM Server URL (noapm-server, no:8200, no/intake/v2/events)OTEL_EXPORTER_OTLP_HEADERS—"Authorization=ApiKey <key>"or"Authorization=Bearer <token>"
- Do NOT set
OTEL_TRACES_EXPORTER,OTEL_METRICS_EXPORTER, orOTEL_LOGS_EXPORTER— the defaults are already correct - Do NOT add code-level SDK setup (no
TracerProvider, noconfigure_azure_monitor, etc.) —opentelemetry-instrumenthandles everything - Never run both classic
elastic-apmand EDOT on the same application
Examples
See the EDOT Python setup guide for complete examples.
Related skills
More from elastic/agent-skills and the wider catalog.

observability-edot-python-migrate
Migrate Python applications from classic Elastic APM agent to EDOT Python agent.

observability-k8s-investigation
>

observability-llm-obs
Monitor LLM performance, cost, tokens, and agentic workflows in Elastic.

observability-logs-search
Search and filter Observability logs with ES|QL to investigate incidents, errors, and anomalies.

observability-manage-slos
Create and manage SLOs in Elastic Observability using the Kibana API.

observability-service-health
Assess APM service health using SLOs, alerts, ML anomalies, latency, error rate, and dependencies.