Chapter 10. Distributed tracing

download PDF

The client offers distributed tracing based on the Jaeger implementation of the OpenTracing standard.

10.1. Enabling distributed tracing

Use the following steps to enable tracing in your application:


  1. Add the Jaeger client dependency to your POM file.


    ${jaeger-version} must be 1.0.0 or later.

  2. Add the jms.tracing option to your connection URI. Set the value to opentracing.

    Example: A connection URI with tracing enabled


  3. Register the global tracer.

    Example: Global tracer registration

    import io.jaegertracing.Configuration;
    import io.opentracing.Tracer;
    import io.opentracing.util.GlobalTracer;
    public class Example {
        public static void main(String[] args) {
            Tracer tracer = Configuration.fromEnv("<service-name>").getTracer();
            // ...

  4. Configure your environment for tracing.

    Example: Tracing configuration

    $ export JAEGER_SAMPLER_TYPE=const
    $ java -jar example.jar net.example.Example

    The configuration shown here is for demonstration purposes. For more information about Jaeger configuration, see Configuration via Environment and Jaeger Sampling.

To view the traces your application captures, use the Jaeger Getting Started to run the Jaeger infrastructure and console.

Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.