observability-edot-python-instrument
Original:🇺🇸 English
Translated
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.
10installs
Sourceelastic/agent-skills
Added on
NPX Install
npx skill4agent add elastic/agent-skills observability-edot-python-instrumentTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →EDOT Python Instrumentation
Read the setup guide before making changes:
Guidelines
- Install via pip (add to
elastic-opentelemetryor equivalent)requirements.txt - Run during image build to install auto-instrumentation packages for detected libraries
edot-bootstrap --action=install - Wrap the application entrypoint with — e.g.
opentelemetry-instrumentoropentelemetry-instrument gunicorn app:app. Without this, no telemetry is collectedopentelemetry-instrument python app.py - Set exactly three required environment variables:
OTEL_SERVICE_NAME- — must be the managed OTLP endpoint or EDOT Collector URL. Never use an APM Server URL (no
OTEL_EXPORTER_OTLP_ENDPOINT, noapm-server, no:8200)/intake/v2/events - —
OTEL_EXPORTER_OTLP_HEADERSor"Authorization=ApiKey <key>""Authorization=Bearer <token>"
- Do NOT set ,
OTEL_TRACES_EXPORTER, orOTEL_METRICS_EXPORTER— the defaults are already correctOTEL_LOGS_EXPORTER - Do NOT add code-level SDK setup (no , no
TracerProvider, etc.) —configure_azure_monitorhandles everythingopentelemetry-instrument - Never run both classic and EDOT on the same application
elastic-apm
Examples
See the EDOT Python setup guide for
complete examples.