Merge pull request #42 from DataDog/gpolaert/dropwizard
Improving dropwizard documentation/example
This commit is contained in:
commit
83393ea3f0
|
@ -31,9 +31,13 @@ First, get the latest version of the dd-java-agent:
|
|||
curl -OL http://central.maven.org/maven2/com/datadoghq/dd-java-agent/{version}/dd-java-agent-{version}.jar
|
||||
```
|
||||
|
||||
Then, add the agent to the JVM. That can be done by providing the following argument:
|
||||
`java -javaagent:/path/to/dd-java-agent-{version}.jar ...`.
|
||||
|
||||
Then, build the app add the agent to the JVM. That can be done as follow:
|
||||
```
|
||||
cd path/to/dd-trace-examples/dropwizard-mongo-client
|
||||
gradle clean shadowJar
|
||||
java -javaagent:/path/to/dd-java-agent-{version}.jar -jar build/libs/dropwizard-mongo-client-{version}-all.jar server
|
||||
```
|
||||
### Generate traces
|
||||
|
||||
|
||||
|
@ -41,8 +45,10 @@ Then, add the agent to the JVM. That can be done by providing the following argu
|
|||
|
||||
Once the application runs. Go to the following url:
|
||||
|
||||
* [http://localhost:8080/demo/add?title=some-book-title&isbn=1234&page=42]()
|
||||
* [http://localhost:8080/demo/]()
|
||||
|
||||
|
||||
Then get back to Datadog and wait a bit to see a trace coming.
|
||||
|
||||
#### Cross process tracing: with the provided `TracedClient` class
|
||||
|
@ -57,6 +63,8 @@ Cross process tracing is working thanks to headers injected on the client side t
|
|||
|
||||

|
||||
|
||||
To run the distributed example, first start the dropwizard app, the mongo db and finally run the `main` from `com.example.helloworld.client.TracedClient`
|
||||
|
||||
### How did we instrument this project?
|
||||
|
||||
#### Auto-instrumentation with the `dd-trace-agent`
|
||||
|
@ -66,6 +74,7 @@ The instrumentation is entirely done by the datadog agent which embed a set of r
|
|||
- The Java servlet filters
|
||||
- The Mongo client
|
||||
- The OkHTTP client
|
||||
- The `@Trace` annotation
|
||||
|
||||
The Datadog agent embeds the [open tracing java agent](https://github.com/opentracing-contrib/java-agent).
|
||||
We strongly recommend you to refer to the [Datadog Agent documentation](../../dd-java-agent) if you want to dig deeper.
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "2.0.1"
|
||||
}
|
||||
|
||||
description = 'dropwizard-mongo-client'
|
||||
|
||||
dependencies {
|
||||
compile project(':dd-trace-annotations')
|
||||
|
||||
|
@ -9,3 +14,13 @@ dependencies {
|
|||
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.4.2'
|
||||
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.7.0'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': 'com.example.helloworld.HelloWorldApplication'
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
mergeServiceFiles()
|
||||
}
|
Loading…
Reference in New Issue