- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
The latest Java Tracer supports all JVMs version 8 and higher. For additional information about JVM versions below 8, read Supported JVM runtimes.
For a full list of Datadog’s Java version and framework support (including legacy and maintenance versions), read Compatibility Requirements.
Before you begin, make sure you’ve already installed and configured the Agent.
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:
dd-java-agent.jar
that contains the latest tracer class files, to a folder that is accessible by your Datadog user:wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
curl -Lo dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
ADD 'https://dtdg.co/latest-java-tracer' dd-java-agent.jar
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:
java -javaagent:/path/to/dd-java-agent.jar -Ddd.profiling.enabled=true -XX:FlightRecorderOptions=stackdepth=256 -Ddd.logs.injection=true -Ddd.service=my-app -Ddd.env=staging -Ddd.version=1.0 -jar path/to/your/app.jar
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.
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. Starting in version 1.18.3, if Agent Remote Configuration is enabled where this service runs, you can set DD_LOGS_INJECTION in the Service Catalog UI. |
DD_PROFILING_ENABLED | dd.profiling.enabled | Enable the Continuous Profiler |
DD_SERVICE | dd.service | The name of a set of processes that do the same job. Used for grouping stats for your application. |
DD_TRACE_SAMPLE_RATE | dd.trace.sample.rate | Set a sampling rate at the root of the trace for all services. Starting in version 1.18.3, if Agent Remote Configuration is enabled where this service runs, you can set DD_TRACE_SAMPLE_RATE in the Service Catalog UI. |
DD_TRACE_SAMPLING_RULES | dd.trace.sampling.rules | Set a sampling rate at the root of the trace for services that match the specified rule. |
DD_VERSION | dd.version | Your application version (for example, 2.5 , 202003181415 , or 1.3-alpha ) |
Additional configuration options are described below.
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 your app is called my_app.jar
, create a my_app.conf
, containing:
JAVA_OPTS=-javaagent:/path/to/dd-java-agent.jar
For more information, see the Spring Boot documentation.
To enable tracing when running Tomcat on Linux:
setenv.sh
.setenv.sh
:CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/dd-java-agent.jar"
To enable tracing when running Tomcat as a Windows service:
./bin
directory of the Tomcat project folder.Java Options
:-javaagent:C:\path\to\dd-java-agent.jar
In standalone mode:
Add the following line to the end of standalone.conf
:
JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/dd-java-agent.jar"
standalone.conf.bat
:set "JAVA_OPTS=%JAVA_OPTS% -javaagent:X:/path/to/dd-java-agent.jar"
In domain mode:
Add the following line in the file domain.xml
, under the tag server-groups.server-group.jvm.jvm-options:
<option value="-javaagent:/path/to/dd-java-agent.jar"/>
For more details, see the JBoss documentation.
If you use jetty.sh
to start Jetty as a service, edit it to add:
JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:/path/to/dd-java-agent.jar"
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:
-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:
java -javaagent:/path/to/dd-java-agent.jar -jar my_app.jar
For more information, see the Oracle documentation.
Never add dd-java-agent
to your classpath. It can cause unexpected behavior.
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:
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.