After you install and configure your Datadog Agent, the next step is to add the tracing library directly in the application to instrument it. Read more about compatibility information.
To begin tracing your applications:
Download dd-java-agent.jar that contains the latest tracer class files, to a folder that is accessible by your Datadog user:
Note: To download the latest build of a specific major version, use the https://dtdg.co/java-tracer-vX link instead, where X is the desired major version.
For example, use https://dtdg.co/java-tracer-v1 for the latest version 1 build. Minor version numbers must not be included. Alternatively, see Datadog’s Maven repository for any specific version.
Note: Release Candidate versions are made available in GitHub DataDog/dd-trace-java releases. These have “RC” in the version and are recommended for testing outside of your production environment. You can subscribe to GitHub release notifications to be informed when new Release Candidates are available for testing. If you experience any issues with Release Candidates, reach out to Datadog support.
To run your app from an IDE, Maven or Gradle application script, or java -jar command, with the Continuous Profiler, deployment tracking, and logs injection (if you are sending logs to Datadog), add the -javaagent JVM argument and the following configuration options, as applicable:
If you have a strong need to reduce the size of your image and omit modules, you can use the jdeps command to identify dependencies. However, required modules can change over time, so do this at your own risk.
Enabling profiling may impact your bill depending on your APM bundle. See the pricing page for more information.
Environment Variable
System Property
Description
DD_ENV
dd.env
Your application environment (production, staging, etc.)
DD_LOGS_INJECTION
dd.logs.injection
Enable automatic MDC key injection for Datadog trace and span IDs. See Advanced Usage for details.
Use the documentation for your application server to figure out the right way to pass in -javaagent and other JVM arguments. Here are instructions for some commonly used frameworks:
If you use start.ini to start Jetty, add the following line (under --exec, or add --exec line if it isn’t there yet):
-javaagent:/path/to/dd-java-agent.jar
In the administrative console:
Select Servers. Under Server Type, select WebSphere application servers and select your server.
Select Java and Process Management > Process Definition.
In the Additional Properties section, click Java Virtual Machine.
In the Generic JVM arguments text field, enter:
-javaagent:/path/to/dd-java-agent.jar
For additional details and options, see the WebSphere docs.
Note
If you’re adding the -javaagent argument to your java -jar command, it needs to be added before the -jar argument, as a JVM option, not as an application argument. For example:
Automatic instrumentation for Java uses the java-agent instrumentation capabilities provided by the JVM. When a java-agent is registered, it can modify class files at load time.
Note: Classes loaded with remote ClassLoader are not instrumented automatically.
Instrumentation may come from auto-instrumentation, the OpenTracing API, or a mixture of both. Instrumentation generally captures the following info:
Timing duration is captured using the JVM’s NanoTime clock unless a timestamp is provided from the OpenTracing API
Key/value tag pairs
Errors and stack traces which are unhandled by the application
A total count of traces (requests) flowing through the system
If needed, configure the tracing library to send application performance telemetry data as you require, including setting up Unified Service Tagging. Read Library Configuration for details.