Spring Cloud Feign + Sleuth + Zipkin-需要原始请求

时间:2019-01-18 23:46:22

标签: spring zipkin feign

我有使用Spring Cloud OpenFeign的多服务应用程序。现在,我必须在该应用程序中使用zipkin。我记得当我有没有Feign的应用程序时,我只是添加了Sleuth和Zipkin启动程序依赖项,并在端口9411上运行zipkin服务器。此后Zipkin运行良好。 >“需要原始请求” 。我想当Sleuth添加跟踪信息时,Feign的标头会出现一些问题。你能帮我解决这个问题吗?

3 个答案:

答案 0 :(得分:1)

使用以下依赖项管理进行春季启动,以下载适用于云版本的版本

    <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

我正在使用Java 10,cloud.version是 Finchley.SR2 ,并且sprinb-boot:2.2.0和spring-cloud-starter-openfeign:2.1.2.RELEASE。这种组合对我来说可以解决此问题。

实际问题是10.x.x feign-core不能正常运行,而io.github.openfeign:feign-core:jar:9.7.0:compile可以正常工作。

答案 1 :(得分:1)

我使用Java 11,springboot 2.3.0.RELEASE和spring-cloud版本Greenwich.RELEASE遇到了这个问题。添加以下依赖项为我节省了时间:

    <dependency>
        <groupId>io.github.openfeign</groupId>
        <artifactId>feign-okhttp</artifactId>
        <version>10.2.0</version>
    </dependency>
    <dependency>
        <groupId>io.github.openfeign</groupId>
        <artifactId>feign-core</artifactId>
        <version>10.2.0</version>
    </dependency>

希望这对某人有帮助。

答案 2 :(得分:0)

没有更多信息很难说。但这可能与不兼容的库有关。您可以发布依赖项吗?

如果您将okhttpclient的较旧版本最新 spring cloud:greenwich一起使用,则可能导致此问题。

我正在将 Greenwich.RELEASE okhttpclient:10.2.0 一起使用,