Back to Skills

observability-edot-java-instrument

Instrument a Java application with the Elastic Distribution of OpenTelemetry (EDOT) Java agent for automatic tracing, metrics, and logs. Use when adding observability to a Java service that has no existing APM agent.

535stars41forksUpdated 7/17/2026

Security Assessment

Safe(100/100)
Security Score100/100

About observability-edot-java-instrument

The observability-edot-java-instrument skill instruments a Java application with the Elastic Distribution of OpenTelemetry (EDOT) Java agent, enabling automatic tracing, metrics, and logs. It is intended for adding observability to a Java service that has no existing APM agent, walking through the correct way to attach the agent and configure its export destination without touching application code. The skill points to the official EDOT Java setup, OpenTelemetry Java agent, and EDOT Java configuration guides as the authoritative references to read before making changes.

The core workflow centers on using the elastic-otel-javaagent.jar downloaded from Maven Central (not as a Maven or Gradle compile dependency) and attaching it via -javaagent:/path/to/elastic-otel-javaagent.jar or the JAVA_TOOL_OPTIONS environment variable; without this attachment the agent does nothing. Exactly three required environment variables are set: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT (which must be the managed OTLP endpoint or EDOT Collector URL, never an APM Server URL with apm-server, :8200, or /intake/v2/events), and OTEL_EXPORTER_OTLP_HEADERS carrying an Authorization ApiKey or Bearer token. The skill explicitly warns against setting OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER because the defaults are already correct.

This skill targets developers and operators onboarding Java services into an Elastic observability stack via OpenTelemetry. A stated hard rule is to never run both the classic Elastic APM agent and the EDOT agent on the same JVM. Requirements include access to a managed OTLP endpoint or EDOT Collector and a valid API key or bearer token. For complete Dockerfile and docker-compose examples the skill defers to the linked EDOT Java setup guide rather than reproducing them inline.

FAQ

How is the EDOT Java agent attached to my application?

Attach elastic-otel-javaagent.jar via the JVM flag -javaagent:/path/to/elastic-otel-javaagent.jar or through JAVA_TOOL_OPTIONS="-javaagent:/path/to/elastic-otel-javaagent.jar". Without this attachment the agent does nothing.

Which environment variables are required?

Exactly three: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT (the managed OTLP endpoint or EDOT Collector URL), and OTEL_EXPORTER_OTLP_HEADERS set to "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.

Should I set the exporter environment variables like OTEL_TRACES_EXPORTER?

No. Do not set OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER — the defaults are already correct.

Can I run this alongside the classic Elastic APM agent?

No. You must never run both the classic Elastic APM agent and the EDOT agent on the same JVM. Also obtain the jar from Maven Central rather than adding it as a Maven or Gradle compile dependency.

Install observability-edot-java-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