Skip to main content
This guide covers Java applications running on ECS, EC2, Kubernetes, or any container/VM environment. For Java on AWS Lambda, see the Java Lambda guide.

1. Install the OpenTelemetry Java Agent

Download the latest opentelemetry-javaagent.jar from the OpenTelemetry Java instrumentation releases and attach it to your JVM startup:
Alternatively, if you are using Gradle, you can use the Gradle Javaagent Plugin to attach the agent to your application. For full configuration options, see the official OpenTelemetry Java Agent docs.

2. Set Environment Variables

Add the following environment variables to your application. Replace YOUR_TRACE0_ENV_API_KEY with the API key from your Trace0 environment. Also set the following additional environment variable for your cloud provider.
Alternatively, you can set all these environment variables in a YAML file using declarative configuration.

3. Kubernetes Setup

If your application runs on Kubernetes, including Amazon EKS, Google Kubernetes Engine or Azure Kubernetes Service, add the following environment variables to your container specification.

4. Deploy Service

Deploy your service and watch traces, metrics, and logs appear in the Trace0 dashboard within seconds.

Example Service

See our Java ECS example app and Java EC2 example app for working services you can deploy to your AWS account.