opentelemetry-java-instrume.../examples/spring-boot-jdbc-redis
Tyler Benson 9a52303376 Apply jacoco to every java project
Some projects have ignores/whitelists, but generally coverage is pretty high.

AFAIK, this doesn’t really capture instrumentation test coverage though.
2018-05-04 16:23:32 +10:00
..
gradle/wrapper Upgrade gradle version. 2018-04-27 12:42:51 +10:00
src/main Added Redis instrumentation via Jedis client 2.9 and changed spring-boot-jdbc to spring-boot-jdbc-redis 2018-02-05 12:59:42 -05:00
README.md Added Redis instrumentation via Jedis client 2.9 and changed spring-boot-jdbc to spring-boot-jdbc-redis 2018-02-05 12:59:42 -05:00
docker-compose.yml Added Redis instrumentation via Jedis client 2.9 and changed spring-boot-jdbc to spring-boot-jdbc-redis 2018-02-05 12:59:42 -05:00
gradlew Added Redis instrumentation via Jedis client 2.9 and changed spring-boot-jdbc to spring-boot-jdbc-redis 2018-02-05 12:59:42 -05:00
gradlew.bat Added Redis instrumentation via Jedis client 2.9 and changed spring-boot-jdbc to spring-boot-jdbc-redis 2018-02-05 12:59:42 -05:00
spring-boot-jdbc-redis.gradle Apply jacoco to every java project 2018-05-04 16:23:32 +10:00

README.md

Spring-boot

This project provides a simple API using Spring Boot. The framework is supported and auto-instrumentation is used to trace the endpoints.

Run the demo

Prerequisites

Be sure to build the project so that the latest version of dd-trace-java components are used. You can build all libraries and examples launching from the dd-trace-java root folder:

./gradlew clean shadowJar bootRepackage

Then you can launch the Datadog agent and a Redis instance as follows:

cd examples/spring-boot-jdbc-redis
DD_API_KEY=<your_datadog_api_key> docker-compose up -d

A valid DD_API_KEY is required to post collected traces to the Datadog backend.

Run the application

To launch the application, just:

./gradlew bootRun

Note: The bootRun Gradle command appends automatically the -javaagent argument, so that you don't need to specify the path of the Java Agent. Gradle executes the :examples:spring-boot-jdbc-redis:bootRun task until you stop it.

Or as an executable jar:

java -javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar -Ddd.service.name=spring-boot-jdbc-redis -jar build/libs/spring-boot-jdbc-redis-demo.jar

Generate traces

Once the Gradle task is running. Go to the following urls:

Then get back to Datadog and wait a bit to see a trace coming.

Auto-instrumentation with the dd-trace-agent

The instrumentation is entirely done by the datadog agent which embed a set of rules that automatically recognizes & instruments:

  • The java servlet filters
  • The JDBC driver
  • The Jedis Redis client

The Java Agent embeds the OpenTracing Java Agent.