spring cloud 整合zpkin問題

spring cloud sleuth集成zipkin後,默認配置下沒有什麼問題!java

可是將跟蹤數據存儲存改爲elasticsearch後Dependencies的依賴關係就沒法查看了,這個問題困擾了好久,斷斷續續找了好久,無心參考到http://www.springcloud.cn/?/question/72 這位仁兄的解釋mysql

看源碼發現ElasticsearchHttpSpanStore是經過查找庫中的dependencylink來計算dependency tree的,
可是源碼中並未看到elastisc search將其持久化到es,請問是否暫未被sc支持,或者須要額外啓用?
========================================================================================================================================================================================================
搞定了。
https://github.com/openzipkin/zipkin-dependencies
 
按照說明下載最新的jar,而後執行以下命令,則會基於es算出dependencies
STORAGE_TYPE=elasticsearch ES_HOSTS=hostOfElasticSearch  ES_DATE_SEPARATOR=. java -jar zipkin-dependencies.jar

其中https://github.com/openzipkin/zipkin-dependencies根據這裏的操做提示便可git

首先下載jar包github

wget -O zipkin-dependencies.jar 'https://search.maven.org/remote_content?g=io.zipkin.dependencies&a=zipkin-dependencies&v=LATEST'

而後根據storage填寫參數便可spring

這裏只寫elasticsearch,若是是其它數據庫的查看https://github.com/openzipkin/zipkin-dependencies查看就好了sql

Elasticsearch Storage

運行下面的命令數據庫

STORAGE_TYPE=elasticsearch ES_HOSTS=http://localhost:9200 java -jar zipkin-dependencies.jar

STORAGE_TYPE #是哪一個數據庫,若是是elasticsearch就寫elasticsearch,mysql的就寫mysql,如此類推app

ES_HOSTS #是指elasticsearch數據庫地址,若是有多個用逗號隔開便可如:ES_HOSTS=host1,host2elasticsearch

java -jar xxx.jar 運行jar包maven

執行命令大概幾秒鐘就完成了,執行完成後,再查看Dependencies依賴關係圖就會顯示出來了

17/09/27 15:53:23 INFO ElasticsearchDependenciesJob: Processing spans from zipkin-2017-09-27/span
17/09/27 15:53:23 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/09/27 15:53:25 WARN Java7Support: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added
17/09/27 15:53:34 INFO ElasticsearchDependenciesJob: Saving dependency links to zipkin-2017-09-27/dependencylink
17/09/27 15:53:35 INFO ElasticsearchDependenciesJob: Processing spans from zipkin:span-2017-09-27/span
17/09/27 15:53:35 INFO ElasticsearchDependenciesJob: No spans found at zipkin:span-2017-09-27/span
相關文章
相關標籤/搜索