Skip to content

nklmish/go-distributed-tracing-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Distributed tracing demo in Golang

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.

dependecy diagram generated by zipkin

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.

Dependencies

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 running process

Install

go install

Launch

cd $GOPATH/bin
./go-distributed-tracing-demo

Override defaults

You can also override default parameters, please refer to help for more details i.e.

./go-distributed-tracing-demo --help

available options to override

Or if you are using Intellij, then you can override those parameter in run configuration. override options in intellij

Sample Request

curl -v http://localhost:8090/1 | jq .
[
  {
    "name": "Product A-100"
  },
  {
    "name": "Product B-100"
  }
]

Zipkin-UI

You can visit [localhost:9411] (http://localhost:9411) providing you are running zipkin locally and select go-product-service selecting-services

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

Zipkin-ui

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)

Error Spans

For ids >= 3 digits, application generates traces with error E.g.

curl -v http://localhost:8090/1000 | jq .

error
You can click to find out more about error error-detail-view

About

Demo application for distributed tracing in Golang and java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages