mcpField
O
observability-edot-python-instrument

observability-edot-python-instrument

github.com/elasticCloud & DevOps6022.7k installsUpdated today
Repository

About observability-edot-python-instrument

A skill that guides setup of EDOT Python auto-instrumentation for application telemetry. It is intended for developers instrumenting Python services and emphasizes environment-based configuration rather than code-level SDK setup.

Key features

  1. 01Install `elastic-opentelemetry`
  2. 02Bootstrap detected library instrumentation
  3. 03Wrap the application entrypoint
  4. 04Configure required OTLP environment variables
  5. 05Avoid conflicting exporters and classic `elastic-apm`

Use cases

  1. 01Instrument a Python application during deployment
  2. 02Configure telemetry export to a managed OTLP endpoint or EDOT Collector

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/elastic/agent-skills --skill observability-edot-python-instrument

After installing, type/observability-edot-python-instrumentin Claude Code to confirm it loaded.

Details

From the project README

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.

Comments

Markdown supported