PluginBench
Skill
Review
Audit score 70

observability-edot-java-instrument

elastic/agent-skills

Instrument Java applications with Elastic's OpenTelemetry agent for automatic tracing, metrics, and logs.

What is observability-edot-java-instrument?

Adds automatic observability to Java services using the Elastic Distribution of OpenTelemetry (EDOT) Java agent. Use this when you need to enable tracing, metrics, and log collection on a Java application without an existing APM agent.

  • Automatically instruments Java applications for distributed tracing
  • Collects application metrics and performance data
  • Gathers structured logs from the application
  • Exports telemetry to Elastic's managed OTLP endpoint or EDOT Collector
  • Requires only JVM startup flag configuration—no code changes needed

How to install observability-edot-java-instrument

npx skills add https://github.com/elastic/agent-skills --skill observability-edot-java-instrument
Prerequisites
  • Java application (JDK 8 or later)
  • Access to Elastic's managed OTLP endpoint or EDOT Collector
  • API key or bearer token for authentication
  • Network connectivity from the Java application to the OTLP endpoint
Claude Code
Cursor
Windsurf
Cline

How to use observability-edot-java-instrument

  1. 1.Download elastic-otel-javaagent.jar from Maven Central
  2. 2.Set three required environment variables: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT (managed OTLP URL), and OTEL_EXPORTER_OTLP_HEADERS (with API key or bearer token)
  3. 3.Attach the agent to your Java application using -javaagent:/path/to/elastic-otel-javaagent.jar JVM flag or JAVA_TOOL_OPTIONS environment variable
  4. 4.Start your Java application—the agent will automatically begin collecting traces, metrics, and logs
  5. 5.Verify telemetry is flowing in your Elastic observability platform

Use cases

Good for
  • Adding observability to a new Java microservice
  • Migrating from no APM to OpenTelemetry-based monitoring
  • Instrumenting Java applications in containerized environments
  • Collecting traces and metrics for performance analysis and debugging
  • Integrating Java services into an Elastic observability platform
Who it's for
  • Java developers building microservices
  • DevOps engineers setting up application monitoring
  • Platform teams implementing observability infrastructure
  • Java application owners needing APM without code modifications

observability-edot-java-instrument FAQ

Can I use the EDOT Java agent alongside the classic Elastic APM agent?

No. Never run both agents on the same JVM. Choose one or the other.

What endpoint should I use for OTEL_EXPORTER_OTLP_ENDPOINT?

Use the managed OTLP endpoint or EDOT Collector URL. Do not use an APM Server URL (no apm-server, no :8200, no /intake/v2/events).

Do I need to set OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER?

No. Do not set these variables—the defaults are already correct for EDOT.

Can I use the agent as a Maven or Gradle compile dependency?

No. Download elastic-otel-javaagent.jar directly from Maven Central and attach it via -javaagent flag, not as a dependency.

What if the agent is not attached to the JVM?

The agent will do nothing without the -javaagent flag or JAVA_TOOL_OPTIONS environment variable. Ensure it is properly configured before starting the application.

Full instructions (SKILL.md)

Source of truth, from elastic/agent-skills.


name: observability-edot-java-instrument description: > 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. metadata: author: elastic version: 0.1.1

EDOT Java Instrumentation

Read the setup guide before making changes:

Guidelines

  1. Use elastic-otel-javaagent.jar (download from Maven Central, not a Maven/Gradle compile dependency)
  2. Attach via -javaagent:/path/to/elastic-otel-javaagent.jar or JAVA_TOOL_OPTIONS="-javaagent:/path/to/elastic-otel-javaagent.jar" — without this the agent does nothing
  3. 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>"
  4. Do NOT set OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, or OTEL_LOGS_EXPORTER — the defaults are already correct
  5. Never run both classic Elastic APM agent and EDOT agent on the same JVM

Examples

See the EDOT Java setup guide for complete Dockerfile and docker-compose examples.