微服务架构 | 链路追踪 - [Sleuth]
@
§1 简介
Spring Cloud Sleuth provides API for distributed tracing solution for Spring Cloud. It integrates with OpenZipkin Brave
Spring Cloud Sleuth is able to trace your requests and messages so that you can correlate that communication to corresponding log entries. You can also export the tracing information to an external system to visualize latency. Spring Cloud Sleuth supports OpenZipkin compatible systems directly.
Spring Cloud Sleuth 提供了对 Spring Cloud 的链路追踪解决方案,并整合 OpenZipkin
Spring Cloud Sleuth 可以追踪你的请求和消息,以便于你通过相关的日志条目将那些通信关联起来。你也可以导出跟踪信息到一个外部系统来把延时可视化。Spring Cloud Sleuth supports 可以直接整合 OpenZipkin
§2 简单使用
依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
配置
spring:
application:
name: order-service
zipkin:
base-url: http://192.168.3.7:9411
sleuth:
sampler:
#采样率值介于 0 到 1 之间,1 则表示全部采集,通常0.5
probability: 1
效果
使用 9411 端口查看
传送门:
微服务架构 | 组件目录