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- 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
How to use observability-edot-java-instrument
- 1.Download elastic-otel-javaagent.jar from Maven Central
- 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.Attach the agent to your Java application using -javaagent:/path/to/elastic-otel-javaagent.jar JVM flag or JAVA_TOOL_OPTIONS environment variable
- 4.Start your Java application—the agent will automatically begin collecting traces, metrics, and logs
- 5.Verify telemetry is flowing in your Elastic observability platform
Use cases
- 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
- 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
No. Never run both agents on the same JVM. Choose one or the other.
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).
No. Do not set these variables—the defaults are already correct for EDOT.
No. Download elastic-otel-javaagent.jar directly from Maven Central and attach it via -javaagent flag, not as a dependency.
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
- Use
elastic-otel-javaagent.jar(download from Maven Central, not a Maven/Gradle compile dependency) - Attach via
-javaagent:/path/to/elastic-otel-javaagent.jarorJAVA_TOOL_OPTIONS="-javaagent:/path/to/elastic-otel-javaagent.jar"— without this the agent does nothing - Set exactly three required environment variables:
OTEL_SERVICE_NAMEOTEL_EXPORTER_OTLP_ENDPOINT— must be the managed OTLP endpoint or EDOT Collector URL. Never use an APM Server URL (noapm-server, no:8200, no/intake/v2/events)OTEL_EXPORTER_OTLP_HEADERS—"Authorization=ApiKey <key>"or"Authorization=Bearer <token>"
- Do NOT set
OTEL_TRACES_EXPORTER,OTEL_METRICS_EXPORTER, orOTEL_LOGS_EXPORTER— the defaults are already correct - 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.
Related skills
More from elastic/agent-skills and the wider catalog.

observability-edot-java-migrate
Migrate Java applications from classic Elastic APM agent to EDOT Java agent.

observability-edot-python-instrument
Instrument Python apps with Elastic Distribution of OpenTelemetry for automatic tracing, metrics, and logs.

observability-edot-python-migrate
Migrate Python applications from classic Elastic APM agent to EDOT Python agent.

observability-k8s-investigation
>

observability-llm-obs
Monitor LLM performance, cost, tokens, and agentic workflows in Elastic.

observability-logs-search
Search and filter Observability logs with ES|QL to investigate incidents, errors, and anomalies.