You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot中Jaeger无法追踪WebClient请求问题求助

解决WebClient请求Jaeger链路追踪不显示的问题

1. 补充WebClient链路追踪依赖

当前依赖缺少WebFlux/WebClient的OpenTracing集成包,需添加与现有opentracing starter版本一致的依赖:

implementation 'io.opentracing.contrib:opentracing-spring-webflux-starter:3.3.1'

2. 配置WebClient追踪过滤器

如果是手动创建WebClient实例,必须注入追踪过滤器并加入到请求链中:

import io.opentracing.contrib.web.spring.webfilter.TracingExchangeFilterFunction;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
public class WebClientConfig {

    @Bean
    public WebClient webClient(TracingExchangeFilterFunction tracingFilter) {
        return WebClient.builder()
                .filter(tracingFilter)
                .build();
    }
}

若使用WebClient.Builder自动注入,添加依赖后Spring会自动为Builder追加追踪过滤器,直接注入使用即可。

3. 排查Jaeger上报与查询问题

  • 日志检查:查看应用日志中是否存在Jaeger客户端发送失败的报错(如网络不通、端口错误),当前配置同时开启了UDP和HTTP Sender,建议根据Jaeger实际部署方式保留一种配置,避免冲突。
  • UI查询验证:确认Jaeger UI的查询条件,服务名选择myServiceName,时间范围覆盖请求发生时段,避免因筛选条件错误导致数据无法展示。

4. 验证链路生成

重启应用后发起请求,查看日志是否生成WebClient相关的Span(如包含目标URL的Span记录),若日志中出现多个Span上报,再去Jaeger UI查询完整链路。

内容的提问来源于stack exchange,提问作者emoleumassi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 17:11:09