Back to Skills

observability-edot-python-instrument

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.

535stars41forksUpdated 7/17/2026

Security Assessment

Safe(100/100)
Security Score100/100

About observability-edot-python-instrument

observability-edot-python-instrument instruments a Python application with the Elastic Distribution of OpenTelemetry (EDOT) Python agent so it emits automatic tracing, metrics, and logs. It is intended for adding observability to a Python service that has no existing APM agent, and it directs the user to the official EDOT Python setup and configuration references and the OpenTelemetry Python zero-code auto-instrumentation docs before making changes.

The setup follows a small set of concrete steps. Install elastic-opentelemetry via pip (adding it to requirements.txt or equivalent). Run edot-bootstrap --action=install during image build to install auto-instrumentation packages for detected libraries. Wrap the application entrypoint with opentelemetry-instrument, for example opentelemetry-instrument gunicorn app:app or opentelemetry-instrument python app.py; without this wrapper no telemetry is collected. Then set exactly three required environment variables: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT (which must be the managed OTLP endpoint or EDOT Collector URL, never an APM Server URL), and OTEL_EXPORTER_OTLP_HEADERS (an Authorization ApiKey or Bearer value).

The skill is aimed at developers and operators adding APM to Python services. It states several firm constraints: do not set OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER because the defaults are already correct; do not add code-level SDK setup such as a TracerProvider or configure_azure_monitor because opentelemetry-instrument handles everything; and never run both classic elastic-apm and EDOT on the same application. The endpoint must not point at an APM Server (no apm-server, no :8200, no /intake/v2/events). Complete examples are available in the linked EDOT Python setup guide.

FAQ

What are the required steps to instrument a service?

Install elastic-opentelemetry via pip, run edot-bootstrap --action=install during image build, wrap the app entrypoint with opentelemetry-instrument (e.g., opentelemetry-instrument gunicorn app:app), and set the three required environment variables. Without the opentelemetry-instrument wrapper, no telemetry is collected.

Which environment variables must I set?

Exactly three: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT (the managed OTLP endpoint or EDOT Collector URL), and OTEL_EXPORTER_OTLP_HEADERS (either "Authorization=ApiKey <key>" or "Authorization=Bearer <token>").

Can I point the endpoint at an APM Server?

No. OTEL_EXPORTER_OTLP_ENDPOINT must be the managed OTLP endpoint or EDOT Collector URL. Never use an APM Server URL — no apm-server, no :8200, and no /intake/v2/events.

Do I need to add exporter variables or SDK code?

No. Do not set OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER because the defaults are correct, and do not add code-level SDK setup like TracerProvider or configure_azure_monitor because opentelemetry-instrument handles it.

Can I run this alongside the classic Elastic APM agent?

No. Never run both classic elastic-apm and EDOT on the same application. This skill is intended for a Python service that has no existing APM agent.

Install observability-edot-python-instrument

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill