Explore how to enable and customize tracing of JAX-RS and non-JAX-RS methods by using MicroProfile OpenTracing and Jaeger.
You will learn how to enable automatic tracing for JAX-RS methods and create custom tracers for non-JAX-RS methods by using MicroProfile OpenTracing.
OpenTracing is a standard API for instrumenting microservices for distributed tracing. Distributed tracing helps troubleshoot microservices by examining and logging requests as they propagate through a distributed system, allowing developers to tackle the otherwise difficult task of debugging these requests.
Without a distributed tracing system in place, analyzing the workflows of operations becomes difficult, particularly in regard to pinpointing when and by whom a request is received or when a response is sent back.
Tracer and Span are two critical types in the OpenTracing specification. The Span type is the primary building block of a distributed trace, representing an individual unit of work done in a distributed system. The Trace type in OpenTracing can be thought of as a directed acyclic graph (DAG) of Spans, where the edges between Spans are called References. The Tracer interface creates Spans and Traces and understands how to serialize and deserialize their metadata across process boundaries.
MicroProfile OpenTracing enables distributed tracing in microservices. The MicroProfile OpenTracing specification doesnât address the problem of defining, implementing, or configuring the underlying distributed tracing system. Rather, the specification makes it easier to instrument services with distributed tracing given an existing distributed tracing system.
Jaeger is an open source distributed tracing system that is compatible with the OpenTracing specification. Jaeger also provides an implementation of Tracer in the client package that is compatible with MicroProfile OpenTracing.
Youâll configure the provided inventory and system services to use Jaeger for distributed tracing with MicroProfile OpenTracing. Youâll run these services in two separate JVMs made of two server instances to demonstrate tracing in a distributed environment. If all the components were run on a single server, then any logging software would be sufficient.
Created byÂ
The Open Liberty Project team