2.6 Application Tracing
OpenTracing with Jaeger Tracing
We use OpenTracing for the distributed tracing. Our tracing backend is Jaeger.
Our application includes the following dependencies in the
||MicroProfile OpenTracing implementation||MicroProfile OpenTracing|
||Provides traces for database queries.||Using OpenTracing|
The following configurations need to be made in the
application.properties to setup the tracing:
endpoint: defines where we will send our metrics
service-name: the name of the current service
constdefines a constant sampling
sampler-param: percentage of request which are sampled.
1defines that we want to sample all requests.
Further we need to change our database driver to the tracing enabled driver.
Last we change the Quarkus log format to include the
spanId in the logs. This is not necessary but will
ConfigurationThe configuration listed above may slightly differ from the one used in the solution repository. This is because some properties are overridden using environment variables in the
Using the configuration made is basically everything which is needed to get traces from our application. By default all requests to
RESTful endpoints are traced. Using the
TracingDriver provides spans for all database queries.
If you want to customize the tracing you can annotate any class or method with the
@Traced annotation. You may also
disable the default tracing with
@Traced(false). Further you may inject the
Tracer to your application code. Using
this tracer you can create custom spans in business methods or add tags to span.
This snipped is from class
This will create a span for the method
createOrder and name it accordingly. Using the injected
Tracer we tag the span
with the just created
Task 2.6.1 - Inspect the application traces
Start up your environment if not already running and point your browser to the Jaeger UI at http://localhost:16686/
Issue requests as described in section 2.4
- Do you find traces for created orders? You may list all traces or use the tag filter
- How do traces look like if the operationName is not set?
- Do you see the tag
order.idon the span?
- What happens if you inject an exception as described in section 2.4?
Traces from application code with no explicit name are named by their class and method. If an exception is thrown, there
will be a tag
error=true on the span. The Jaeger UI will flag such spans with an exclamation mark.