opentelemetry-java-instrume.../dd-trace-examples/spring-boot-jdbc
Tyler Benson b40bcf9973 Add automatic instrumentation for JDBC
This instrumentation creates spans for Statements and PreparedStatements. It also captures the corresponding SQL and additional connection info.  ResultSet could be considered for future instrumentation to capture even more of the DB interaction time.

This integration uses Bytebuddy instead of Byteman as the many methods to instrument would have been messy in Byteman.
2017-10-24 10:28:53 -07:00
..
gradle/wrapper Don’t exclude the wrapper jar 2017-08-01 15:09:51 -07:00
src/main Add automatic instrumentation for JDBC 2017-10-24 10:28:53 -07:00
README.md Add automatic instrumentation for JDBC 2017-10-24 10:28:53 -07:00
docker-compose.yml [example] update Spring Boot example with a simplified documentation 2017-08-04 15:50:28 +02:00
gradlew Add gradlew to examples and update docs 2017-07-21 17:03:31 -07:00
gradlew.bat Add gradlew to examples and update docs 2017-07-21 17:03:31 -07:00
spring-boot-jdbc.gradle Add automatic instrumentation for JDBC 2017-10-24 10:28:53 -07: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 as follows:

cd dd-trace-examples/spring-boot-jdbc
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 :dd-trace-examples:spring-boot-jdbc:bootRun task until you stop it.

Or as an executable jar:

java -javaagent:../../dd-java-agent/build/libs/dd-java-agent-{version}.jar -jar build/libs/spring-boot-jdbc-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 Java Agent embeds the OpenTracing Java Agent.