There are a few samples with slightly different features. You can run all of them from an IDE via the main method, or on the command line with mvn spring-boot:run
. They all log trace and span data on the console by default. Here’s a list:
spring-cloud-sleuth-sample
: vanilla (no zipkin) web app that calls back to itself on various endpoints ("/", "/call", "/async")
spring-cloud-sleuth-sample-zipkin
: same as vanilla sample but with zipkin (set sample.zipkin.enabled=true
if you have a collector running)
spring-cloud-sleuth-sample-messaging
: a Spring Integration application with two HTTP endpoints ("/" and "/xform")
spring-cloud-sleuth-sample-ribbon
: two endpoints ("/" and "/call") that make calls to the "zipkin" sample via Ribbon. Also has `@EnableZUulProxy" so if the other samples are running they are proxied at "/messaging", "/zipkin", "/vanilla" (see "/routes" for a list).
The Ribbon sample makes an interesting demo or playground for learning about zipkin. In the screenshot below you can see a trace with 3 spans - it starts in the "testSleuthRibbon" app and crosses to "testSleuthMessaging" for the next 2 spans.
Optionally run the Zipkin Server, e.g. via docker compose (there’s a docker-compose.yml
in Spring Cloud Sleuth, or in Docker Zipkin
Run the zipkin sample application (set sample.zipkin.enabled=false
if you have no Zipkin running). If you are using a VM to run docker you might need to tunnel port 9411 to localhost, or change the spring.zipkin.baseUrl
.
Hit http://localhost:3380
, http://localhost:3380/call
, http://localhost:3380/async
for some interesting sample traces (the app callas back to itself).
Go to http://localhost:9411
for Zipkin’s UI (if you are using boot2docker the host will be different)
Note
|
You can see the zipkin spans without the UI (in logs) if you run the sample with sample.zipkin.enabled=false .
|
The fact that the first trace in says "testSleuthMessaging" seems to be a bug in the UI (it has some annotations from that service, but it originates in the "testSleuthRibbon" service).
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。