一、zipkin作用

  • 全链路追踪工具(查看依赖关系
  • 查看每个接口、每个service的执行速度(定位问题发生点或者寻找性能瓶颈

二、zipkin工作原理

  • 创造一些追踪标识符(tracingId,spanId,parentId),最终将一个request的流程树构建出来

三、zipkin架构

1、Transport

  • transport作用:收集被trace的services的spans,并将它们转化为zipkin common Span,之后把这些Spans传递的存储层。
  • 三种主要的transport:
    • HTTP(默认)

      • 通过http headers来传递追踪信息
      • header中的key
        • X-B3-TraceId: 64 encoded bits(id被encode为hex Strings)
        • X-B3-SpanId: 64 encoded bits
        • X-B3-ParentSpanId: 64 encoded bits
        • X-B3-Sampled: Boolean (either “1” or “0”)(下面的调用是否进行采样)
        • X-B3-Flags: a Long
    • Scribe
    • Kafka

2、基础架构(4个组件)

  • collector

    • 作用:zipkin collector会对一个到来的被trace的数据(span)进行验证、存储并设置索引。
  • storage
  • search
  • webUI

四、zipkin核心数据结构

  • Annotation(用途:用于定位一个request的开始和结束,cs/sr/ss/cr含有额外的信息,比如说时间点)

    • cs:Client Start - This sets the beginning of the span

      • 一个span的开始
    • sr:Server Receive - The server has received the request and will start processing it
    • ss:Server Send - The server has completed processing and has sent the request back to the client
    • cr:Client Receive - The client has received the response from the server. This sets the end of the span. The RPC is considered complete when this annotation is recorded
      • 一个span的结束
      • 当这个annotation被记录了,这个RPC也被认为完成了
  • BinaryAnnotation(用途:They are meant to provide extra information about the RPC)
  • Span:就是一个请求(包含一组Annotation和BinaryAnnotation)
    • Spans contain identifying information such as traceId, spandId, parentId, and RPC name
  • Trace
    • Traces are built by collecting all Spans that share a traceId
    • 通过traceId、spanId和parentId,被收集到的span会汇聚成一个tree,从而提供出一个request的整体流程。(这也是zipkin的工作原理)

注意:时间点计算

  • sr-cs:网络延迟
  • ss-sr:逻辑处理时间
  • cr-cs:整个流程时间

五、Trace identifiers

  • 含义:通过下边3个Id,对数据进行重组
  • 三个Id(64位 long型数据)
    • TraceId

      • The overall ID of the trace.
      • Every span in a trace will share this ID.
    • SpanId
      • The ID for a particular span.
      • This may or may not be the same as the trace id.
    • ParentId
      • This is an optional ID that will only be present on child spans.
      • That is the span without a parent id is considered the root of the trace.

六:zipkin工作流程图

说明:

  • X和A可以相等

疑问

  • spanId==C的span为什要有,是否可以省掉?

父子span关系:

说明:parentId==null,表示该span就是root span。

七、注意点

1、使用zipkin,必须使用java8

2、在生产环境,不会对每个请求都进行采样追踪(降低trace对整个服务的性能损耗)

参考:

http://zipkin.io/

https://github.com/openzipkin/zipkin/tree/master/zipkin-server server配置

附8 zipkin的更多相关文章

  1. 第二十七章 springboot + zipkin(brave-okhttp实现)

    本文截取自:http://blog.csdn.net/liaokailin/article/details/52077620 一.前提 1.zipkin基本知识:附8 zipkin 2.启动zipki ...

  2. 【第二十七章】 springboot + zipkin(brave-okhttp实现)

    本文截取自:http://blog.csdn.net/liaokailin/article/details/52077620 一.前提 1.zipkin基本知识:附8 zipkin 2.启动zipki ...

  3. springboot + zipkin(brave-okhttp实现)

    一.前提 1.zipkin基本知识:附8 zipkin 2.启动zipkin server: 2.1.在官网下载服务jar,http://zipkin.io/pages/quickstart.html ...

  4. 【附8】zipkin

    一.zipkin作用 全链路追踪工具(查看依赖关系) 查看每个接口.每个service的执行速度(定位问题发生点或者寻找性能瓶颈) 二.zipkin工作原理 创造一些追踪标识符(tracingId,s ...

  5. springcloud微服务实战:Eureka+Zuul+Feign/Ribbon+Hystrix Turbine+SpringConfig+sleuth+zipkin

    相信现在已经有很多小伙伴已经或者准备使用springcloud微服务了,接下来为大家搭建一个微服务框架,后期可以自己进行扩展.会提供一个小案例: 服务提供者和服务消费者 ,消费者会调用提供者的服务,新 ...

  6. spring cloud 系列第7篇 —— sleuth+zipkin 服务链路追踪 (F版本)

    源码Gitub地址:https://github.com/heibaiying/spring-samples-for-all 一.简介 在微服务架构中,几乎每一个前端的请求都会经过多个服务单元协调来提 ...

  7. C# 多种方式发送邮件(附帮助类)

    因项目业务需要,需要做一个发送邮件功能,查了下资料,整了整,汇总如下,亲测可用- QQ邮箱发送邮件 #region 发送邮箱 try { MailMessage mail = new MailMess ...

  8. 【开源毕设】一款精美的家校互动APP分享——爱吖校推 [你关注的,我们才推](持续开源更新3)附高效动态压缩Bitmap

    一.写在前面 爱吖校推如同它的名字一样,是一款校园类信息推送交流平台,这么多的家校互动类软件,你选择了我,这是我的幸运.从第一次在博客园上写博客到现在,我一次一次地提高博文的质量和代码的可读性,都是为 ...

  9. 轻量级通信引擎StriveEngine —— C/S通信demo(附源码)

    前段时间,有几个研究ESFramework的朋友对我说,ESFramework有点庞大,对于他们目前的项目来说有点“杀鸡用牛刀”的意思,因为他们的项目不需要文件传送.不需要P2P.不存在好友关系.也不 ...

随机推荐

  1. 深入分析 ThreadLocal

    ThreadLoacal是什么? ThreadLocal是啥?以前面试别人时就喜欢问这个,有些伙伴喜欢把它和线程同步机制混为一谈,事实上ThreadLocal与线程同步无关.ThreadLocal虽然 ...

  2. Python的浮点数损失精度问题

    本篇讨论的现象可以从下面这段脚本体现出来: >>> x = 0.0 >>> for i in range(10): x += 0.1 print(x) 0.1 0. ...

  3. 理解、学习与使用 JAVA 中的 OPTIONAL<转>

    从 Java 8 引入的一个很有趣的特性是 Optional  类.Optional 类主要解决的问题是臭名昭著的空指针异常(NullPointerException) —— 每个 Java 程序员都 ...

  4. 以太坊客户端Geth命令用法-参数详解【转载】

    原文链接:http://www.cnblogs.com/tinyxiong/p/7918706.html Geth在以太坊智能合约开发中最常用的工具(必备开发工具),一个多用途的命令行工具.熟悉Get ...

  5. Ubuntu 16.04 ROS环境配置

    最近新入职一家公司,是搞智能无人驾驶的,用的操作系统是Ubuntu和ros,之前没接触过ros系统,既然公司用那就必须的学习啊,话不多说先装它一个ros玩玩... 1. Ubuntu 安装 ROS K ...

  6. AssetManager

    AssetManager用于获取assets下的资源. 1.getassets()得到AssetManager 2.AssetManager.close() 关闭AssetManager 3.Reso ...

  7. FatFs文件系统的移植

    FatFs 的底层可以写一次命令,读写多个扇区.FatFs的设计的读写的思想就很好,小块的数据,我就经过Buffer来存储,大块的数据,我就直接进行存取,那样速度,效率高了很多,看图: FatFs文件 ...

  8. 【转】Yelp是如何实现每天运行数百万个测试的

    Yelp每天要运行数百万个测试,确保开发人员提交的代码不会对已有的功能造成破坏.如此巨大规模的测试,他们是怎么做到的呢?以下内容翻译自 Yelp 的技术博客,并已获得翻译授权,查看原文 How Yel ...

  9. Golang 笔记 1 基础、基本数据类型

    一.Go语言基础 1. 基础 Go语言中的标识符必须以字母(Unicode字母,PHP/JS可以用中文作为变量名)下划线开头.大写字母跟小写字母是不同的:Hello和hello是两个不同的名字.  G ...

  10. 【IEEE会议论文】格式规范问题

    - Text area: The height of the text should not be much smaller than 23.5 cm  and the width should no ...