The sample app contains product-services, which generates bunch of products for a given id. It uses db and analytic service to fetch products.To keep things simpler we simulated those services.
This app can be used as standalone or more interestingly along with [catalog-service] (https://github.com/nklmish/java-distributed-tracing-demo) (distributed application) to see how we can trace along services developed in different languages.
The project needs [open-zipkin] (https://github.com/openzipkin/docker-zipkin) and mongodb to be up and running. You can launch them locally via docker:
docker run -d -p 9411:9411 openzipkin/zipkin
docker run -p 27017:27017 -d mongo
Verify whether everything is up
docker ps
And you should see something like this
go install
cd $GOPATH/bin
./go-distributed-tracing-demo
You can also override default parameters, please refer to help for more details i.e.
./go-distributed-tracing-demo --help
Or if you are using Intellij, then you can override those parameter in run configuration.
curl -v http://localhost:8090/1 | jq .
[
{
"name": "Product A-100"
},
{
"name": "Product B-100"
}
]
You can visit [localhost:9411] (http://localhost:9411) providing you are running zipkin locally and select go-product-service
And dependending on randomness(check the source code) you will see either blue or yellow traces. The blue ones depicts traces without any problem and yellow ones depicts traces containing span with error logs
You can click a particular span to view more details ![Detail view] (https://cloud.githubusercontent.com/assets/13149921/20249225/255891be-a9f5-11e6-9a34-2298936cf958.png)
For ids >= 3 digits, application generates traces with error E.g.
curl -v http://localhost:8090/1000 | jq .