Python Instrumentation with EDOT

VerifiedSafe

Guide to instrument a Python application with the Elastic Distribution of OpenTelemetry (EDOT) agent for automatic tracing, metrics, and logs.

Sby Skills Guide Bot
DevOpsIntermediate
7/26/2026
Claude CodeCursorWindsurfCopilotCodex
#observability#opentelemetry#python#tracing#elastic

Recommended for

Automated summary

Instruments a Python application with the Elastic Distribution of OpenTelemetry (EDOT) agent so traces, metrics, and logs are collected automatically.

Strengths

  • Gives a minimal, explicit procedure: install elastic-opentelemetry, run edot-bootstrap --action=install, then wrap the entrypoint with opentelemetry-instrument.
  • Names the exact three required environment variables (OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS).
  • Prevents common mistakes: do not set the exporter variables, do not add SDK setup code, do not point at an APM Server URL.
  • Flags that classic elastic-apm and EDOT must never run on the same application.

Limitations

  • Assumes a managed OTLP endpoint or an EDOT Collector already exists; provisioning them is out of scope.
  • Does not cover custom manual instrumentation (business spans, attributes) or how to verify that telemetry actually arrives.
  • Gives no version pinning guidance and assumes a Docker build step plus a requirements file.
When to use it

Use it to add baseline observability to a Python service that has no existing APM agent and reports to Elastic.

When not to use it

Avoid it if the app already runs elastic-apm, if no OTLP endpoint or EDOT Collector is available, or if you need custom in-code instrumentation.

Security analysis

Safe
Quality score88/100

The skill is purely instructional and does not execute any commands or use any tools. It provides configuration guidance for adding OpenTelemetry instrumentation to Python applications, including installing packages and setting environment variables, but does not perform destructive actions, exfiltrate data, or disable safety features.

No concerns found

How this analysis is made

Examples

Instrument a Flask service
Add EDOT OpenTelemetry instrumentation to my Python service in this Flask app (app.py served by gunicorn): install elastic-opentelemetry, install the auto-instrumentation packages, wrap the start command with opentelemetry-instrument, and set OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS.
Update Dockerfile for EDOT
Our Dockerfile builds a FastAPI app with pip requirements.txt. Update it so the image runs edot-bootstrap --action=install at build time and starts with opentelemetry-instrument uvicorn main:app, without adding any TracerProvider code in the app.
Fix wrong OTLP endpoint
My Python app has OTEL_EXPORTER_OTLP_ENDPOINT set to our APM Server URL on port 8200 and no telemetry shows up. Review my OpenTelemetry env vars and correct the setup for EDOT, including the Authorization header format.

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.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/python-instrumentation-with-edot-ms1cu0a4/download' --output '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md.part' && mv '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md.part' '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md' && test -s '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/observability-edot-python-instrument' && cp -R '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4' '.claude/skills/observability-edot-python-instrument'

Cursor
test -f '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md' && test -s '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/observability-edot-python-instrument' && cp -R '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4' '.cursor/skills/observability-edot-python-instrument'

Codex
test -f '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md' && test -s '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/observability-edot-python-instrument' && cp -R '.skill-downloads/python-instrumentation-with-edot-ms1cu0a4' '.agents/skills/observability-edot-python-instrument'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/python-instrumentation-with-edot-ms1cu0a4'

openskills read 'python-instrumentation-with-edot-ms1cu0a4'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/python-instrumentation-with-edot-ms1cu0a4/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills