调用netflix FeignClient时未保留跟踪ID

时间:2019-05-16 06:14:31

标签: netflix-feign spring-cloud-sleuth zipkin

我正在使用spring-cloud-sleuth-zipkin和spring-cloud-starter-sleuth作为依赖项。

当我呼叫netflix FeignClient呼叫时,TraceId发生变化...

import org.springframework.cloud.netflix.feign.FeignClient;

@FeignClient
public interface TesterClient {
@RequestLine("GET /testCall")
@Headers({"Authorization: Bearer {bearerToken}",
        "Content-Type: application/json"})
ResponseEntity<Test> testMethod(@Param("bearerToken") String bearerToken);
}

@Bean
public TesterClient testerClient() {
    return Feign.builder()
            .decoder(new TestDecoder()).encoder(new TestEncoder())
            .logLevel(Logger.Level.FULL).target(TesterClient.class, 
this.testUrl);
}

当我致电TesterClient时,traceId会更改吗?我如何保留相同的traceId?

0 个答案:

没有答案