1.Zipkin

  是一个开放源代码分布式的跟踪系统

  它可以帮助收集服务的时间数据,以解决微服务架构中的延迟问题,包括数据的收集、存储、查找和展现

  每个服务向zipkin报告计时数据,zipkin会根据调用关系通过Zipkin UI生成依赖关系图,展示多少跟踪请求经过了哪些服务,该系统让开发者可通过一个web前端轻松地收集和分析数据,可非常方便的监测系统中存在的瓶颈

  Zipkin提供了可插拔数据存储方式:In-Memory、MySql、Cassandra以及Elasticsearch

  生产数据量大的情况则推荐使用Elasticsearch

2.Spring Cloud Sleuth

  为服务之间的调用提供链路追踪,通过使用Sleuth可以让我们快速定位某个服务的问题

  分布式服务追踪系统包括:数据收集、数据存储、数据展示

  通过Sleuth产生的调用链监控信息,让我们可以得知微服务之间的调用链路,但是监控信息只输出到控制台不太方便查看

  Sleuth和Zipkin结合,将信息发送到Zipkin,利用Zipkin的存储来存储信息,利用Zipkin UI来展示信息

1.使用curl下载

curl -sSL https://zipkin.io/quickstart.sh | bash -s

下载了文件zipkin-server-2.19.1-exec.jar

2.启动服务

java -jar zipkin-server-2.19.-exec.jar

通过http://localhost:9411可访问zipkin的监控页面

因为还没有客户端,所以还没有数据

默认启动方式会将日志数据存在内存中,一旦服务重启会清空数据,可以使用es进行持久化存储

3.应用

添加依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>

spring-cloud-dependencies

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

配置

spring.application.name=demo
spring.zipkin.base-url=http://localhost:9411
spring.sleuth.sampler.probability=1.0

样本采集量,默认为0.1,为了测试修改为1,正式环境一般使用默认值

package com.example.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
public class Demo { @RequestMapping("hello")
public String hello() {
return "Hello World!";
}
}

运行示例,在postman里执行http://localhost:8080/hello

再查看http://localhost:9411,出现了刚刚访问的服务,选择并点击追踪

选择demo服务,点击Find Traces

点击调用记录查看详情页面,可以看到每一个服务所耗费的时间和顺序

3.通过ElasticSearch进行存储

ElasticSearch安装启动(安装说明)

zipkin服务启动命令改为

java  -DSTORAGE_TYPE=elasticsearch -DES_HOSTS=http://localhost:9200 -jar zipkin-server-2.19.1-exec.jar

zipkin会在es中创建以zipkin开头日期结尾的index,并且默认以天为单位分割

使用kibana查看数据(kibana使用)

https://zipkin.io/pages/quickstart.html

Zipkin+Sleuth 链路追踪整合的更多相关文章

  1. SpringCloud Sleuth + Zipkin 实现链路追踪

    一.Sleuth介绍   为什么要使用微服务跟踪? 它解决了什么问题? 1.微服务的现状?   随着业务的发展,单体架构变为微服务架构,并且系统规模也变得越来越大,各微服务间的调用关系也变得越来越复杂 ...

  2. spring cloud 2.x版本 Sleuth+Zipkin分布式链路追踪

    前言 本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 本文基于前两篇文章eureka-server.eureka-client.eureka ...

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

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

  4. Spring Cloud 系列之 Sleuth 链路追踪(一)

    随着微服务架构的流行,服务按照不同的维度进行拆分,一次请求往往需要涉及到多个服务.互联网应用构建在不同的软件模块集上,这些软件模块,有可能是由不同的团队开发.可能使用不同的编程语言来实现.有可能布在了 ...

  5. Spring Cloud 系列之 Sleuth 链路追踪(二)

    本篇文章为系列文章,未读第一集的同学请猛戳这里:Spring Cloud 系列之 Sleuth 链路追踪(一) 本篇文章讲解 Sleuth 基于 Zipkin 存储链路追踪数据至 MySQL,Elas ...

  6. zipkin分布式链路追踪系统

    基于zipkin分布式链路追踪系统预研第一篇   分布式服务追踪系统起源于Google的论文“Dapper, a Large-Scale Distributed Systems Tracing Inf ...

  7. Spring Cloud 系列之 Sleuth 链路追踪(三)

    本篇文章为系列文章,未读前几集的同学请猛戳这里: Spring Cloud 系列之 Sleuth 链路追踪(一) Spring Cloud 系列之 Sleuth 链路追踪(二) 本篇文章讲解 Sleu ...

  8. SpringCloud之链路追踪整合Sleuth(十三)

    前言 SpringCloud 是微服务中的翘楚,最佳的落地方案. 在一个完整的微服务架构项目中,服务之间的调用是很复杂的,当其中某一个服务出现了问题或者访问超时,很 难直接确定是由哪个服务引起的,所以 ...

  9. 原理分析dubbo分布式应用中使用zipkin做链路追踪

    zipkin是什么 Zipkin是一款开源的分布式实时数据追踪系统(Distributed Tracking System),基于 Google Dapper的论文设计而来,由 Twitter 公司开 ...

随机推荐

  1. CF472G Increase the Constraints

    Increase the Constraints 定义两个等长的01字符串的汉明距离为它们字符不同的对应位置的个数. 给你两个01串S,T,现在有q个询问,每次指定S,T中两个定长的子串询问它们的汉明 ...

  2. spark调优——JVM调优

    对于JVM调优,首先应该明确,(major)full gc/minor gc,都会导致JVM的工作线程停止工作,即stop the world. JVM调优一:降低cache操作的内存占比 1.   ...

  3. What is the difference between Reactjs and Rxjs?--React is the V (View) in MVC (Model/View/Controller).

    This is really different, React is view library; and Rxjs is reactive programming library for javasc ...

  4. rune 数据类型

    // rune is an alias for int32 and is equivalent to int32 in all ways. It is // used, by convention, ...

  5. [React] Fetch Data with React Suspense

    Let's get started with the simplest version of data fetching with React Suspense. It may feel a litt ...

  6. ent 基本使用七 Config

    通过config 我们可以自定义表相关的选项 参考配置 package schema ​ import ( "github.com/facebookincubator/ent" & ...

  7. redisql 试用

    redisql 是一个redis 模块,可以让redis 支持sql 查询,基于rust编写 具有以下特性 快速,每秒130k的插入 使用标准sql 容易操作,基于redis,使用标准的redis 二 ...

  8. 51 Nod 1135 原根

    基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 设m是正整数,a是整数,若a模m的阶等于φ(m),则称a为模m的一个原根.(其中φ(m)表示m的欧拉函数) 给出1个质数P ...

  9. shell 查找字符串中字符出现的位置

    #!/bin/bash a="The cat sat on the mat" test="cat" awk -v a="$a" -v b=& ...

  10. Tecplot——为动画添加求解时间(翻译)

    翻译自:<Tecplot 360 Getting Started Manual>中的Scenic Detour: Add Solution Time Caption 首先展示效果: 在画图 ...