提问者:小点点

使用Jaeger跟踪Apache Camel路由


我使用Spring Boot开发了一条Camel路线。现在我想使用Jaeger跟踪路线。我尝试此示例使用camel-opentace组件跟踪路线,但我无法获取Jaeger的踪迹。

我只能在控制台中看到它。我不清楚的一件事是在哪里添加Jaeger URL?任何工作示例都会很有帮助。


共2个答案

匿名用户

Apache Camel没有提供OpenTracing的实现,因此您还必须向依赖项添加一个实现。例如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>

此外,您还必须在Spring Boot应用程序类上启用针对Apache Camel的OpenTracing,请参阅Spring Boot:

如果您使用的是Spring Boot,那么您可以添加camel opentracing starter依赖项,并通过使用camel opentracing注释main类来打开opentracing。

跟踪程序将从camel上下文的注册表或ServiceLoader隐式获取,除非应用程序定义了跟踪程序bean。

Spring Boot应用程序类:

@SpringBootApplication
@CamelOpenTracing
public class CamelApplication {

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

匿名用户

我最终创建了一个JaegerTraces并用Bean注释