更新:我已将代码推送到我的仓库,因此人们可以在那里查看可能出现的问题。
编辑:我几乎可以肯定它是客户端代码没有向服务器发布任何统计信息,但下面的指南都没有解释如何启用它:是否有我缺少的配置设置?
我一直在关注OpenZipkin和Spring Sleuth的快速入门:我有一个从docker-zipkin运行的 Zipkin 服务器,使用docker-compose
Cassandra 作为后端:
$ d ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5ca0f0b29900 openzipkin/zipkin:1.12.1 "/bin/sh -c 'test -n " 14 minutes ago Up 8 minutes 0.0.0.0:9410-9411->9410-9411/tcp zipkin
7b243a0b61e3 openzipkin/zipkin-dependencies "crond -f" 14 minutes ago Up 8 minutes dependencies
e2e047fb3851 openzipkin/zipkin-cassandra:1.12.1 "/bin/sh -c /usr/loca" 14 minutes ago Up 8 minutes 7000-7001/tcp, 0.0.0.0:3306->3306/tcp, 7199/tcp, 0.0.0.0:9042->9042/tcp, 9160/tcp cassandra
我已经创建并运行了Spring Sleuth 示例应用程序,它似乎已正确配置为跟踪调用:
# application.properties)
server.port = 9099
spring.application.name = zipkin-demo
spring.zipkin.baseUrl = http://localhost:9411/
spring.sleuth.sampler.percentage = 1.0
日志似乎表明应该记录跟踪:
2016-10-04 15:20:02.115 INFO [zipkin-demo,c6e06ff47bddaf4d,f7437cf1c7089522,true] 70899 --- [nio-9099-exec-3] com.apple.its.api.ApiController : Forwarding to http://localhost:8088/api/v1/hello
2016-10-04 15:20:02.709 INFO [zipkin-demo,de3c25ea46e8b010,f7e6017757f0ce5e,true] 70899 --- [nio-9099-exec-4] com.apple.its.api.ApiController : Forwarding to http://localhost:8088/api/v1/hello
2016-10-04 15:20:06.480 INFO [zipkin-demo,4c9fdeaab69b79b4,1dc8b9b7ce5c6fa5,true] 70899 --- [nio-9099-exec-5] com.apple.its.api.ApiController : Sleeping for [278] millis
2016-10-04 15:20:08.833 INFO [zipkin-demo,2eb26be1a6867e5,b566753eb137026,true] 70899 --- [nio-9099-exec-8] com.apple.its.api.ApiController : Sleeping for [467] millis
2016-10-04 15:20:10.608 INFO [zipkin-demo,eec83e7fc4ea9c9d,c88723b29ca4335c,true] 70899 --- [nio-9099-exec-1] com.apple.its.api.ApiController : Sleeping for [20] millis
2016-10-04 15:20:12.035 INFO [zipkin-demo,63259dd1bac357e9,5cf013d16bb1ee98,true] 70899 --- [nio-9099-exec-4] com.apple.its.api.ApiController : Sleeping for [22] millis
但是,无论我做什么,UI 都不会显示任何痕迹。奇怪的是,它localhost:9411/trace
确实显示了一堆痕迹(它们似乎主要来自 Zipkin 本身)但没有来自zipkin-demo
应用程序。
我相信这是由于演示应用程序没有将跟踪发送到主机,但我只是使用Spring 的示例应用程序,所以我做错了什么?