Setup OpenTelemetry on a Java setup, with special instructions for SpringBoot.
-D
flags on the JVM) or via a properties/yml configuration file.
The following example will demonstrate using the properties configuration approach as the baseline configuration.
opentelemetry-java
and provides a Java agent JAR that can be attached to any
Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks.
Out of the box, the Java Agent Instrumentation automatically handles most things.
There are a few things we have learned that require additional instrumentations in order to correctly handle complex scenarios such as microservices calling other microservices via http clients.
For those cases, you need to add additional dependencies appropriate for the requested capabilities and register it.
For example, if using Jetty and Java HttpClient, you need to add the following
in order to correctly enable the jetty platform to handle traceIds from the PlayerZero Web SDK as well as propagating that trace id to subsequent microservice calls to other instrumented systems within your stack.
:
.jar
files
application.properties
the same way as the otel.properties
from the Java Agent approach plus a few other changes.
The auto instrumentation is a little more limited in the case of Spring Boot seeming to auto instrument only the webmvc and logging layers.
In order to instrument the JDBC, Mongo, or anything else, additional dependencies and some manual Configuration adjustments are required.
pom.xml
.
pom.xml
file:
pom.xml
file