48.3.3通过RabbitMQ或Kafka与Zipkin一起侦查如果要使用RabbitMQ或Kafka而不是HTTP,请添加spring-rabbit或spring-kafka依赖性.默认目标名称是zipkin.
48.3.3 Sleuth with Zipkin over RabbitMQ or Kafka If you want to use RabbitMQ or Kafka instead of HTTP, add the spring-rabbit or
spring-kafka dependency. The default destination name is zipkin.
如果使用Kafka,则必须设置属性spring.zipkin.sender.type相应的属性:
If using Kafka, you must set the property spring.zipkin.sender.type
property accordingly:
spring.zipkin.sender.type:kafka [注意]注意spring-cloud-sleuth-stream已被弃用并且与这些不兼容目的地.
spring.zipkin.sender.type: kafka [Caution] Caution
spring-cloud-sleuth-stream is deprecated and incompatible with these
destinations.
如果要让Sleuth优于RabbitMQ,请添加spring-cloud-starter-zipkin和spring-rabbit依赖性.
If you want Sleuth over RabbitMQ, add the spring-cloud-starter-zipkin
and spring-rabbit dependencies.
以下示例显示了如何对Gradle进行操作:
The following example shows how to do so for Gradle:
行家.
<dependencyManagement> 1
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${release.train.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies> </dependencyManagement>
<dependency> 2
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId> </dependency> <dependency> 3
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId> </dependency> 1
我们建议您通过Spring添加依赖项管理BOM,因此您无需自己管理版本.
We recommend that you add the dependency management through the Spring
BOM so that you need not manage versions yourself.
2
将依赖项添加到spring-cloud-starter-zipkin.这样,所有嵌套的依赖项将被下载.
Add the dependency to spring-cloud-starter-zipkin. That way, all
nested dependencies get downloaded.
3
要自动配置RabbitMQ,请添加spring-rabbit依赖项.
To automatically configure RabbitMQ, add the spring-rabbit dependency.
等级.
dependencyManagement { 1
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
} }
dependencies {
compile "org.springframework.cloud:spring-cloud-starter-zipkin" 2
compile "org.springframework.amqp:spring-rabbit" 3 } 1
我们建议您通过Spring添加依赖项管理BOM,因此您无需自己管理版本.
We recommend that you add the dependency management through the Spring
BOM so that you need not manage versions yourself.
2
将依赖项添加到spring-cloud-starter-zipkin.这样,所有嵌套的依赖项将被下载.
Add the dependency to spring-cloud-starter-zipkin. That way, all
nested dependencies get downloaded.
3
要自动配置RabbitMQ,请添加spring-rabbit依赖项.
To automatically configure RabbitMQ, add the spring-rabbit dependency.
这篇关于如何通过kafka发送跟踪ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!