本文截取自:http://blog.csdn.net/liaokailin/article/details/52077620

一、前提

1、zipkin基本知识:附8 zipkin

2、启动zipkin server:

2.1、在官网下载服务jar,http://zipkin.io/pages/quickstart.html,之后使用命令启动服务jar即可。

  • nohup java -jar zipkin-server-1.5.1-exec.jar &

之后,查看与该jar同目录下的nohup.out日志文件,发现其实该jar也是由springboot打成的,且内置的tomcat的启动端口是9411,如下:

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

2.2、打开浏览器,http://ip:9411/(host为服务启动的host)。

 

二、代码实现

1、service1

1.1、pom.xml

 1         <dependency>
 2             <groupId>io.zipkin.brave</groupId>
 3             <artifactId>brave-core</artifactId>
 4             <version>3.9.0</version>
 5         </dependency>
 6         <dependency>
 7             <groupId>io.zipkin.brave</groupId>
 8             <artifactId>brave-spancollector-http</artifactId>
 9             <version>3.9.0</version>
10         </dependency>
11         <dependency>
12             <groupId>io.zipkin.brave</groupId>
13             <artifactId>brave-web-servlet-filter</artifactId>
14             <version>3.9.0</version>
15         </dependency>
16         <dependency>
17             <groupId>io.zipkin.brave</groupId>
18             <artifactId>brave-okhttp</artifactId>
19             <version>3.9.0</version>
20         </dependency>
View Code

相关文章: