更新:我已将代码推送到my repo,以便人们可以查看可能出现的问题。
修改:我几乎可以确定客户端代码是不是将任何统计信息发布到服务器,但下面的指南都没有解释如何启用它:是否有配置设置我缺少?
我一直关注OpenZipkin和Spring Sleuth的快速启动:我使用docker-compose
和Cassandra作为后端从docker-zipkin运行Zipkin服务器:< / p>
$ 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 sample app,似乎已正确配置以跟踪调用:
# 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's example app,那么我可能做错了什么?
答案 0 :(得分:4)
如果我没有弄错(我想我不是),难怪你没有将Spans发送给Zipkin因为你没有添加Zipkin依赖。查看文档的{em> Sleuth with Zipkin via HTTP 部分:http://cloud.spring.io/spring-cloud-sleuth/spring-cloud-sleuth.html。
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Brixton.RELEASE"
}
}
dependencies {
compile "org.springframework.cloud:spring-cloud-starter-zipkin"
}
答案 1 :(得分:0)
此配置在我的应用程序之一中适用于我:
spring.zipkin.baseUrl = localhost:9411
spring.sleuth.enabled = true
spring.sleuth.sampler.percentage = 1.0
启用属性可能会起到作用!