Zipkin 不会跟踪整个请求流程,而是作为单独的请求

问题描述 投票:0回答:1

我使用发现服务器( eureka )、api 网关和服务对微服务进行了通用设置。

现在我正在使用 zipking 进行分布式跟踪:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>

<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-exporter-zipkin</artifactId>
</dependency>

我有订单服务,它在内部调用另一个服务来检索信息,在订单服务中我正在使用这段代码:

@Configuration
public class WebClientConfig {
    @Bean
    @LoadBalanced
    public WebClient.Builder webClientBuilder(){
        return WebClient.builder();
    }
}

并致电:

   private final WebClient.Builder webClient;

   ....

   InventoryResponse[] inventoryResponseArray = webClient.build().get()
            .uri("http://inventory-service/api/inventory",
                    uriBuilder -> uriBuilder.queryParam("skuCode", skuCodes).build())
            .retrieve()
            .bodyToMono(InventoryResponse[].class)
            .block();

这个流程的功能正常工作,但是当我研究 zipking 时,我得到:

例如 zipking 不会跟踪从

order-service
inventory-service
的呼叫。但是当我查看 zipkin 时,我看到对
inventory-service
的调用具有不同的
traceId

为什么对

inventory-service
的调用没有显示在流程中,而是作为单独的调用显示?我已经将 WebBuilder 创建为 bean,这意味着 spring 应该注入一些
HttpInterceptor
来添加traceId/spanId。

java spring spring-boot spring-cloud
1个回答
0
投票

我认为你应该将sampler.rate或sampler.probability配置为100%

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.