This repository holds the sample application for illustrating the usage of MicroProfile-Opentracing with Thorntail, Quarkus and Wildfly, and is part of an article you find at https://www.gepardec.com/blog/ among other interesting articles.
This sample application implements a simple JEE application which uses MicroProfile-Opentracing to trace its rest resources as well as rest clients and runs as a microservice with Thorntail, Quarkus and as a WAR deployment in Wildfly.
-
./thorntail-props.yaml
The Thorntail configuration file which defines the rest client configuration properties -
./src/main/resources/application.properties
The Quarkus configuration file which defines the jaeger and rest client configuration properties -
./src/main/resources/project-defaults.yaml
The Thorntail configuration file which defines the jaeger and rest client configuration properties -
./wildfly.properties
The properties file which defines the jaeger and rest client configuration properties -
./src/main/java/com/gepardec/samples/microprofile/opentracing/ExternalRestResource.java
The type safe rest client interface for the external rest resources -
./src/main/java/com/gepardec/samples/microprofile/opentracing/RestResource.java
The rest resource which uses the injectable ExternalResource instance which uses the ClientTracingFeature without modifications -
./src/main/java/com/gepardec/samples/microprofile/opentracing/CustomRestResource.java
The rest resource which builds the ExternalResource instance via the builder and which uses a custom built ClientTracingFeature which uses the ClientSpanDecorator -
./src/main/java/com/gepardec/samples/microprofile/opentracing/ClientSpanDecorator.java
The client side span decorator which adds additional information on the span -
./src/main/java/com/gepardec/samples/microprofile/opentracing/ServerSpanDecorator.java
The server side span decorator which adds additional information on the span -
./src/main/java/com/gepardec/samples/microprofile/opentracing/TracerFactory.java
The tracer factory which creates the tracer and registers it on the GlobalTracer -
./src/main/resources/io.opentracing.contrib.tracerresolver.TracerFactory
The file discovered by SPI which registers the TracerFactory -
./src/main/java/com/gepardec/samples/microprofile/opentracing/TracingInitializerFeature.java
The JAX-RS dynamic feature which uses the ServerSpanDecorator -
./pom.xml
Thepom.xml
defining the Thorntail, Quarkus and Wildfly configurations separated by profiles
mvn clean install -Pthorntail
mvn clean install -Pquarkus
mvn clean install -Pwildfly
mvn thorntail:run -Pthorntail
java "-Djava.net.preferIPv4Stack=true" -jar target\microprofile-opentracing-0.0.1-SNAPSHOT-runner.jar
Tip
|
Normally the maven goal quarkus:dev should start the application as well but it fails with ClassNotFoundException (org/jboss/logging/Logger).I’m not familiar with Qurakus yet, so we run the jar instead. |
mvn wildfly:run -Pwildfly
This sample application requires a Jaeger instance running on localhost:6831
where the traces are sent.
docker run -p 6831:6831/udp -p 16686:16686 --name jaeger-local jaegertracing/all-in-one:latest
If you use Intellij then you can use the test.http
file for testing the rest endpoints.
Otherwise see the following available endpoints and use the tool of your choice.
DELETE http://127.0.0.1:8080/delete