kubernetesapache-camelopentracingjaeger

Tracing Apache Camel route with Jaeger


I have developed a Camel route with Spring Boot. Now I want to trace the route using Jaeger. I tried this example to trace the route using camel-opentracing component, but I am unable to get the traces to Jaeger.

I can only see it in the console. One thing I am not clear is where to add the Jaeger URL? Any working example will be helpful.


Solution

  • Apache Camel doesn't provide an implementation of OpenTracing, so you have to add also an implementation to your dependencies. For example Jaeger.

    Maven POM:

        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-opentracing-starter</artifactId>
            <version>${camel.version}</version>
        </dependency>
        <dependency>
            <groupId>io.opentracing.contrib</groupId>
            <artifactId>opentracing-spring-jaeger-starter</artifactId>
            <version>3.2.2</version>
        </dependency>
    

    Also you have to enable OpenTracing for Apache Camel on your Spring Boot application class, see Spring Boot:

    If you are using Spring Boot then you can add the camel-opentracing-starter dependency, and turn on OpenTracing by annotating the main class with @CamelOpenTracing.

    The Tracer will be implicitly obtained from the camel context’s Registry, or the ServiceLoader, unless a Tracer bean has been defined by the application.

    Spring Boot application class:

    @SpringBootApplication
    @CamelOpenTracing
    public class CamelApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(CamelApplication.class, args);
        }
    }