博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zipkin相关材料
阅读量:5898 次
发布时间:2019-06-19

本文共 5669 字,大约阅读时间需要 18 分钟。

hot3.png

http://zipkin.io/

Zipkin

Web interface screenshot

Zipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in microservice architectures. It manages both the collection and lookup of this data. Zipkin’s design is based on the  paper.

Applications are instrumented to report timing data to Zipkin. The Zipkin UI also presents a Dependency diagram showing how many traced requests went through each application. If you are troubleshooting latency problems or errors, you can filter or sort all traces based on the application, length of trace, annotation, or timestamp. Once you select a trace, you can see the percentage of the total trace time each span takes which allows you to identify the problem application.

Where to go next?

  • To try out Zipkin, check out our 
  • See if your platform has an 
  • Join the 
  • The source code is on GitHub as 
  • Issues are also tracked on 
package api.gateway;import okhttp3.OkHttpClient;public class ZipkinTest {	public static void main(String[] args) throws Exception {		OkHttpClient client = new OkHttpClient();		// 1)处理gateway span		{			String data = "[{\"traceId\":\"daaed0921874ebc3\",\"id\":\"daaed0921874ebc3\",\"name\":\"get\",\"timestamp\":1476197067420000,\"duration\":4694000,\"annotations\":[{\"timestamp\":1476197067420000,\"value\": \"cs\",\"endpoint\": {\"serviceName\": \"gateway\",\"ipv4\":\"1.2.3.4\"}},{\"timestamp\":1476197072114000,\"value\":\"cr\",\"endpoint\":{\"serviceName\":\"gateway\",\"ipv4\": \"1.2.3.4\"}}],\"binaryAnnotations\": [{\"key\": \"http.url\",\"value\": \"http://localhost:8080/service1\",\"endpoint\": {\"serviceName\": \"gateway\",\"ipv4\": \"1.2.3.4\"}}]}]";			String resp = HttpUtils.post(client, "http://1.2.3.4:9411/api/v1/spans", data);			System.out.println(resp);		}		// 2)处理service1		{			String data = "[{\"traceId\": \"daaed0921874ebc3\", \"id\": \"411d4c32c102a974\",\"name\": \"get\",\"parentId\": \"daaed0921874ebc3\",\"timestamp\": 1476197069680000,\"duration\": 1168000,\"annotations\": [{\"timestamp\": 1476197069680000, \"value\": \"cs\",\"endpoint\": {\"serviceName\": \"service1\",\"ipv4\": \"1.2.3.111\"}},{\"timestamp\":1476197070848000,\"value\": \"cr\", \"endpoint\": { \"serviceName\": \"service1\", \"ipv4\": \"1.2.3.111\"}}], \"binaryAnnotations\": [{\"key\": \"http.url\",\"value\":\"http://localhost:8089/service2\",\"endpoint\": {\"serviceName\": \"service1\",\"ipv4\": \"1.2.3.111\" }}]},{\"traceId\": \"daaed0921874ebc3\",\"id\": \"7c0d7d897a858217\",\"name\": \"get\",\"parentId\": \"daaed0921874ebc3\",\"timestamp\": 1476197070850000,\"duration\": 1216000,\"annotations\": [{\"timestamp\": 1476197070850000, \"value\": \"cs\",\"endpoint\": {\"serviceName\": \"service1\",\"ipv4\": \"1.2.3.111\"}},{\"timestamp\": 1476197072066000,\"value\": \"cr\",\"endpoint\": {\"serviceName\": \"service1\",\"ipv4\": \"1.2.3.111\"}}],\"binaryAnnotations\": [{\"key\": \"http.url\", \"value\": \"http://localhost:8090/service3\",\"endpoint\": {\"serviceName\":\"service1\",\"ipv4\":\"1.2.3.111\"}}]},{\"traceId\":\"daaed0921874ebc3\",\"id\":\"daaed0921874ebc3\",\"name\":\"get___\",\"timestamp\":1476197067623000,\"duration\":4479000,\"annotations\":[{\"timestamp\":1476197067623000,\"value\":\"sr\",\"endpoint\":{\"serviceName\":\"service1\",\"ipv4\":\"1.2.3.111\"}},{\"timestamp\":1476197072102000,\"value\":\"ss\",\"endpoint\":{\"serviceName\":\"service1\",\"ipv4\":\"1.2.3.111\"}}],\"binaryAnnotations\":[{\"key\":\"http.status_code\",\"value\":\"2000\",\"endpoint\":{\"serviceName\":\"service1\",\"ipv4\":\"1.2.3.111\"}},{\"key\": \"http.url\",\"value\": \"/service1\",\"endpoint\": {\"serviceName\": \"service1\",\"ipv4\": \"1.2.3.111\"}}]}]";			String resp = HttpUtils.post(client, "http://1.2.3.4:9411/api/v1/spans", data);			System.out.println(resp);		}		// 3)处理service2		{			String data = "[{\"traceId\": \"daaed0921874ebc3\", \"id\": \"411d4c32c102a974\",  \"name\":\"get\",\"parentId\":\"daaed0921874ebc3\",\"timestamp\":1476197069806000,\"duration\":1040000,    \"annotations\": [{  \"timestamp\": 1476197069806000,\"value\": \"sr\",\"endpoint\": {\"serviceName\": \"service2\",\"ipv4\": \"1.2.3.112\"}},{\"timestamp\":1476197070846000, \"value\": \"ss\",\"endpoint\": {\"serviceName\": \"service2\", \"ipv4\": \"1.2.3.112\"}}],\"binaryAnnotations\": [ {\"key\": \"error\",\"value\": \"hello,world!my baby\",\"endpoint\": {\"serviceName\": \"service2\",\"ipv4\": \"1.2.3.112\"}},{\"key\": \"http.status_code\",\"value\": \"2000\",\"endpoint\": {\"serviceName\": \"service2\",\"ipv4\": \"1.2.3.112\"}},{ \"key\": \"http.url\",\"value\": \"/service2\",\"endpoint\": {\"serviceName\": \"service2\",\"ipv4\": \"1.2.3.112\"}}]}]";			String resp = HttpUtils.post(client, "http://1.2.3.4:9411/api/v1/spans", data);			System.out.println(resp);		}		// 4)处理service3		{			String data = "[{\"traceId\": \"daaed0921874ebc3\",\"id\": \"7c0d7d897a858217\",\"name\": \"get\",\"parentId\": \"daaed0921874ebc3\",\"timestamp\": 1476197071011000,\"duration\": 1059000,\"annotations\": [{\"timestamp\": 1476197071011000,\"value\": \"sr\",\"endpoint\": {\"serviceName\": \"service3\",\"ipv4\": \"1.2.3.113\"}},{\"timestamp\": 1476197072070000,\"value\": \"ss\",\"endpoint\": {\"serviceName\": \"service3\",\"ipv4\": \"1.2.3.113\"}}],\"binaryAnnotations\": [{\"key\": \"http.status_code\",\"value\": \"200\",\"endpoint\": {\"serviceName\": \"service3\",\"ipv4\": \"1.2.3.113\"}},{\"key\": \"http.url\", \"value\": \"/service3\", \"endpoint\": { \"serviceName\": \"service3\",\"ipv4\": \"1.2.3.113\"} }]}]";			String resp = HttpUtils.post(client, "http://1.2.3.4:9411/api/v1/spans", data);			System.out.println(resp);		}	}}

 

转载于:https://my.oschina.net/qiangzigege/blog/952654

你可能感兴趣的文章
Apple Developer Registration and DUNS Number Not Accepted
查看>>
Hadoop学习笔记系列文章导航
查看>>
Win7 64位 php-5.5.13+Apache 2.4.9+mysql-5.6.19 配置
查看>>
不同页面之间实现参数传递的几种方式讨论
查看>>
程序员进阶之路—如何独当一面
查看>>
SpringMVC中ModelAndView addObject()设置的值jsp取不到的问题
查看>>
Prometheus : 入门
查看>>
使用 PowerShell 创建和修改 ExpressRoute 线路
查看>>
PHP如何学习?
查看>>
谈教育与成长
查看>>
jni c++
查看>>
在C#中获取如PHP函数time()一样的时间戳
查看>>
Redis List数据类型
查看>>
大数据项目实践(四)——之Hive配置
查看>>
初学vue2.0-组件-文档理解笔记v1.0
查看>>
NG-ZORRO-MOBILE 0.11.9 发布,基于 Angular 7 的 UI 组件
查看>>
我就是一个救火员(DBA救援)
查看>>
Centos7安装Gitlab10.0
查看>>
Windows Server 笔记(六):Active Directory域服务:域控制器安装
查看>>
discuz X3登录流程分析
查看>>