美文网首页
41.Sleuth使用

41.Sleuth使用

作者: LANSHENGYANG | 来源:发表于2020-06-02 09:19 被阅读0次

Sleuth入门

  • 接下来通过之前的项目案例整合Sleuth,完成入门案例的编写。
  • 修改夫工程引入Sleuth依赖
<!--链路追踪-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
  • 启动微服务,调用之后,我们可以在控制台观察到sleuth的日志输出


    image
  • 其中d73e9d12f1a29947是TraceId,d73e9d12f1a29947是SpanId,一次调用有一个全局TraceId,将调用链路串起来。仔细分析每个微服务的日志,不难看出请求的具体过程。
  • 查看日志文件并不是一个很好的方法,当微服务越来越多日志文件也会越来越多,通过Zipkin可以将日志聚合,并进行可视化展示和全文检索。

相关文章

网友评论

      本文标题:41.Sleuth使用

      本文链接:https://www.haomeiwen.com/subject/lpmyzhtx.html