PluginBench
Skill
Review
Audit score 70

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
Prerequisites
  • 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)
Claude Code
Cursor
Windsurf
Cline

How to use observability-edot-python-instrument

  1. 1.Add `elastic-opentelemetry` to your requirements.txt or equivalent dependency file
  2. 2.Run `edot-bootstrap --action=install` during your container image build to auto-install instrumentation packages
  3. 3.Wrap your application entrypoint with `opentelemetry-instrument` (e.g., `opentelemetry-instrument gunicorn app:app`)
  4. 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. 5.Deploy and verify telemetry is flowing to your Elastic cluster

Use cases

Good for
  • 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
Who it's for
  • 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

Do I need to modify my application code?

No. The `opentelemetry-instrument` wrapper handles all instrumentation automatically. Do not add code-level SDK setup like TracerProvider or configure_azure_monitor.

What endpoint should I use for OTEL_EXPORTER_OTLP_ENDPOINT?

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).

Can I use this alongside the classic elastic-apm agent?

No. Never run both classic `elastic-apm` and EDOT on the same application. Choose one or the other.

What should I set for OTEL_TRACES_EXPORTER and OTEL_METRICS_EXPORTER?

Do not set these variables. The defaults are already correct for EDOT and will be overridden if you set them.

Which Python frameworks are supported?

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

  1. Install elastic-opentelemetry via pip (add to requirements.txt or equivalent)
  2. Run edot-bootstrap --action=install during image build to install auto-instrumentation packages for detected libraries
  3. Wrap the application entrypoint with opentelemetry-instrument — e.g. opentelemetry-instrument gunicorn app:app or opentelemetry-instrument python app.py. Without this, no telemetry is collected
  4. Set exactly three required environment variables:
    • OTEL_SERVICE_NAME
    • 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, no /intake/v2/events)
    • OTEL_EXPORTER_OTLP_HEADERS"Authorization=ApiKey <key>" or "Authorization=Bearer <token>"
  5. Do NOT set OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER — the defaults are already correct
  6. Do NOT add code-level SDK setup (no TracerProvider, no configure_azure_monitor, etc.) — opentelemetry-instrument handles everything
  7. Never run both classic elastic-apm and EDOT on the same application

Examples

See the EDOT Python setup guide for complete examples.