Skip to content

Commit 4822c19

Browse files
committed
Remove legacy config references.
1 parent 0fb057d commit 4822c19

17 files changed

Lines changed: 26 additions & 198 deletions

File tree

README.md

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,9 @@ Download the latest Datadog Java Agent:
3535
wget -O dd-java-agent.jar 'https://search.maven.org/remote_content?g=com.datadoghq&a=dd-java-agent&v=LATEST'
3636
```
3737

38-
Then create a file `dd-trace.yaml` anywhere in your application's classpath (or provide the file's path via `-Ddd.trace.configurationFile` when starting the application):
38+
Then configure your application using either environment variables or system properties (on the command line via `-D`). See the [config](#configuration) section for details.
3939

40-
```yaml
41-
# Main service name for the app
42-
defaultServiceName: my-java-app
43-
44-
writer:
45-
type: DDAgentWriter # send traces to Datadog Trace Agent; only other option is LoggingWriter
46-
host: localhost # host/IP address where Datadog Trace Agent listens
47-
port: 8126 # port where Datadog Trace Agent listens
48-
49-
sampler:
50-
type: AllSampler # Collect 100% of traces; only other option is RateSample
51-
# rate: 0.5 # if using type: RateSample, uncomment to collect only 50% of traces
52-
53-
# Skip traces whose root span tag values matches some these regexps; useful if you want to skip health checks traces from your service stats
54-
# skipTagsPatterns: {"http.url": ".*/demo/add.*"}
55-
```
56-
57-
**Note:** this configuration file is also required for [Manual Instrumentation](#manual-instrumentation) with the Datadog Tracer.
40+
**Note:** configuration is also required for [Manual Instrumentation](#manual-instrumentation) with the Datadog Tracer.
5841

5942
Finally, add the following JVM argument when starting your application—in your IDE, your Maven or gradle application script, or your `java -jar` command:
6043

@@ -64,6 +47,17 @@ Finally, add the following JVM argument when starting your application—in your
6447

6548
The Java Agent—once passed to your application—automatically traces requests to the frameworks, application servers, and databases shown below. It does this by using various libraries from [opentracing-contrib](https://github.com/opentracing-contrib). In most cases you don't need to install or configure anything; traces will automatically show up in your Datadog dashboards.
6649

50+
#### Configuration
51+
52+
| Config | System Property | Environment Variable | Default |
53+
| ------------- | ---------------- | -------------------- | ------------------ |
54+
| service.name | dd.service.name | DD_SERVICE_NAME | `unnamed-java-app` |
55+
| writer.type | dd.writer.type | DD_WRITER_TYPE | `DDAgentWriter` |
56+
| agent.host | dd.agent.host | DD_AGENT_HOST | `localhost` |
57+
| agent.port | dd.agent.port | DD_AGENT_PORT | `8126` |
58+
| sampler.type | dd.sampler.type | DD_SAMPLER_TYPE | `AllSampler` |
59+
| sampler.rate | dd.sampler.rate | DD_SAMPLER_RATE | `1.0` |
60+
6761
#### Application Servers
6862

6963
| Server | Versions | Comments |
@@ -91,17 +85,6 @@ Also, frameworks like Spring Boot and Dropwizard inherently work because they us
9185
| [MongoDB](https://github.com/opentracing-contrib/java-mongo-driver) | 3.x | Intercepts all the calls from the MongoDB client |
9286
| [Cassandra](https://github.com/opentracing-contrib/java-cassandra-driver) | 3.2.x | Intercepts all the calls from the Cassandra client |
9387

94-
To disable tracing for any of these libraries, list them in `disabledInstrumentations` within `dd-trace.yaml`:
95-
96-
```yaml
97-
...
98-
99-
# Disable tracing on these
100-
disabledInstrumentations: ["opentracing-apache-httpclient", "opentracing-mongo-driver", "opentracing-web-servlet-filter"]
101-
```
102-
103-
See [this YAML file](dd-java-agent/src/main/resources/dd-trace-supported-framework.yaml) for the proper names of all supported libraries (i.e. the names as you must list them in `disabledInstrumentations`).
104-
10588
### The `@Trace` Annotation
10689

10790
The Java Agent lets you add a `@Trace` annotation to any method to measure its execution time. Setup the [Java Agent](#java-agent-setup) first if you haven't done so.
@@ -124,12 +107,6 @@ For gradle, add:
124107
compile group: 'com.datadoghq', name: 'dd-trace-annotations', version: {version}
125108
```
126109

127-
Then, in `dd-trace.yaml`, list any applications where you want to use `@Trace`:
128-
129-
```yaml
130-
enableCustomAnnotationTracingOver: ["com.example.myproject"]`.
131-
```
132-
133110
The Java Agent lets you use `@Trace` not just for `com.example.myproject`, but also for any application whose name _begins_ like that, e.g. `com.example.myproject.foobar`. If you're tempted to list something like `["com", "io"]` to avoid having to fuss with this configuration as you add new projects, be careful; providing `@Trace`-ability to too many applications could hurt your package's build time.
134111

135112
#### Example
@@ -193,6 +170,8 @@ compile group: 'io.opentracing', name: 'opentracing-util', version: "0.30.0"
193170
compile group: 'com.datadoghq', name: 'dd-trace', version: "${dd-trace-java.version}"
194171
```
195172

173+
Configure your application using environment variables or system properties as discussed in the [config](#configuration) section.
174+
196175
#### Examples
197176

198177
Rather than referencing classes directly from `dd-trace` (other than registering `DDTracer`), we strongly suggest using the [OpenTracing API](https://github.com/opentracing/opentracing-java).
@@ -204,7 +183,7 @@ Let's look at a simple example.
204183
class InstrumentedClass {
205184

206185
void method0() {
207-
// 1. Make sure dd-trace.yaml is in your resources directory
186+
// 1. Configure your application using environment variables or system properties
208187
// 2. If using the Java Agent (-javaagent;/path/to/agent.jar), do not instantiate the GlobalTracer; the Agent instantiates it for you
209188
Tracer tracer = io.opentracing.util.GlobalTracer.get();
210189

@@ -261,8 +240,6 @@ public class Application {
261240
}
262241
```
263242

264-
`DDTracerFactory` looks for `dd-trace.yaml` in the classpath.
265-
266243
## Further Reading
267244

268245
- Browse the [example applications](dd-trace-examples) in this repository to see Java tracing in action

dd-java-agent-ittests/dd-java-agent-ittests.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies {
4040
}
4141

4242
test {
43-
jvmArgs "-Ddd.trace.configurationFile=${project.buildDir}/resources/test/dd-trace.yaml"
43+
jvmArgs "-Ddd.writer.type=ListWriter", "-Ddd.service.name=java-app"
4444
jvmArgs "-Ddd.slf4j.simpleLogger.defaultLogLevel=debug"
4545
jvmArgs "-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"
4646

dd-java-agent-ittests/src/test/resources/dd-trace.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

dd-java-agent/src/main/resources/dd-trace.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

dd-trace-examples/dropwizard-mongo-client/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ A valid ``DD_API_KEY`` is required to post collected traces to the Datadog backe
2727

2828
Launch the application using the run wrapper you've built during the ``installDist`` step:
2929
```bash
30-
JAVA_OPTS=-javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar build/install/dropwizard-mongo-client/bin/dropwizard-mongo-client server
30+
JAVA_OPTS="-javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar -Ddd.service.name=dropwizard-example" build/install/dropwizard-mongo-client/bin/dropwizard-mongo-client server
3131
```
3232

3333
Or as an executable jar:
3434
```bash
35-
java -javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar -jar build/libs/dropwizard-mongo-client-demo-all.jar server
35+
java -javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar -Ddd.service.name=dropwizard-example -jar build/libs/dropwizard-mongo-client-demo-all.jar server
3636
```
3737

3838
``0.2.0-SNAPSHOT`` is an example of what ``{version}`` looks like.

dd-trace-examples/dropwizard-mongo-client/dropwizard-mongo-client.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ apply from: "${rootDir}/gradle/jacoco.gradle"
99
version = 'demo'
1010
description = 'dropwizard-mongo-client'
1111
mainClassName = 'com.datadoghq.example.dropwizard.BookApplication'
12+
applicationDefaultJvmArgs = ["-Ddd.service.name=dropwizard-example"]
13+
1214

1315
sourceCompatibility = 1.8
1416
targetCompatibility = 1.8

dd-trace-examples/dropwizard-mongo-client/src/main/resources/dd-trace.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

dd-trace-examples/rest-spark/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ A valid ``DD_API_KEY`` is required to post collected traces to the Datadog backe
3333

3434
Launch the application using the run wrapper you've built during the ``installDist`` step:
3535
```bash
36-
JAVA_OPTS=-javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar build/install/rest-spark/bin/rest-spark
36+
JAVA_OPTS=-javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar -Ddd.service.name=rest-spark build/install/rest-spark/bin/rest-spark
3737
```
3838

3939
``0.2.0-SNAPSHOT`` is an example of what ``{version}`` looks like.

dd-trace-examples/rest-spark/rest-spark.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ apply from: "${rootDir}/gradle/jacoco.gradle"
99
version = 'demo'
1010
description = 'rest-spark'
1111
mainClassName = 'com.datadoghq.example.restspark.SparkApplication'
12+
applicationDefaultJvmArgs = ["-Ddd.service.name=rest-spark"]
1213

1314
sourceCompatibility = 1.8
1415
targetCompatibility = 1.8

dd-trace-examples/rest-spark/src/main/resources/dd-trace.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)