Distributed Tracing - vidyasekaran/current_learning GitHub Wiki
Followed steps in https://howtodoinjava.com/spring-cloud/spring-cloud-zipkin-sleuth-tutorial/
Source code is present in above link and it is setup in E:\build_complete_microservices\zipkin
Start zipkin from C:\Users\shant\Downloads>java -jar zipkin-server-2.12.9-exec.jar
Invoke service - http://localhost:8081/zipkin See results in - http://localhost:9411/zipkin
Some details about distributed tracing - from udemy course - Spring Boot Microservices with Spring Cloud Beginner to Guru
Distributed Tracing - Transactions in ms span many services/instances. provides tools to trace a transaction across services and nodes used for 2 aspects:
Used to trace request across multiple ms.
- performance monitoring across steps
- logging/ troubleshooting
Spring Cloud Sleuth - distributed tracing tool for spring cloud uses brave underneath
conceptually what happens
- headers on http requests or messages are enhanced with trace data
- logging is enhanced with trace data
- optionally trace data can be reported to zipkin
Tracing Terminology
Span - basic unit of work, typically a send and receive of a message. Trace - a set of spans for a transactions
cs/sr - client sent/server received - aka request ss/cr - server sent /client received - aka response
Usually you will get 1 trace id and multiple span ids
Trace Id - X span id - a,b,c,d,e,f..
ZipKin - to report distributed tracing metrics info can be reported to zipkin via webservices via HTTP, Kafka or rabbit it uses in memory db for dev - cassandra or elasticsearch should be used in prod Use docker or binary distribution for zipkin.
java -jar zipkin.jar http:// :9411/zipkin/
spring-cloud-starter-sleuth (starter for loggin only) spring-cloud-starter-zipkin (starter that brings slueth also)
property sping.zipkin.baseUrl is used to configure zipkin server
Loggin Output
Example : DEBUG [beer-service, kalsd234, klasdj324,true] [Appname, traceid, spanid, exportable]