使用Jaeger追踪Apache Camel路径

q0qdq0h2  于 2022-11-23  发布在  Apache
关注(0)|答案(2)|浏览(90)

我用Sping Boot 开发了一条Camel路线,现在我想用Jaeger追踪路线,我试着用camel-opentracing组件this example追踪路线,但是我无法追踪到Jaeger。
我只能在控制台中看到它。有一件事我不清楚,那就是在哪里添加Jaeger的URL?任何工作示例都会有帮助。

tpxzln5u

tpxzln5u1#

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>

此外,您还必须在Sping Boot 应用程序类上启用OpenTracing for Apache Camel,请参见Spring Boot:
如果您使用的是Sping Boot ,则可以添加camel-opentracing-starter依赖项,并通过使用@CamelOpenTracing注解主类来打开OpenTracing。
除非应用程序已定义Tracer Bean,否则将从camel上下文的注册表或ServiceLoader中隐式获取Tracer。

Sping Boot 应用程序类别:

@SpringBootApplication
@CamelOpenTracing
public class CamelApplication {

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

3b6akqbq2#

我最终创建了一个JaegerTraces并使用Bean进行了注解

相关问题