Wednesday, October 24, 2018

Spring Boot Sleuth and ZipKin

This post is my implementation of the post here: https://reflectoring.io/tracing-with-spring-cloud-sleuth/


Although the post already included the source code, but it is still pretty hard for me to start


So I created this post to help me to remember how to make Slueth and Zipkin work.


Spring Cloud Sleuth


will add traceId and spanId to logger
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<version>${spring-cloud.version}</version>
</dependency>

Analyze Traces with ZipKin


Logger collector and analytics
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>${spring-cloud.version}</version>
</dependency>

spring.sleuth.sampler.percentage=1.0


Is percentage of sampler, the default value is 0.1 ( 10%) that means you only take 10% of request to sampler


Change to 1.0 ( 100% ) to sample all of request.


Repo URL: https://github.com/vanduc1102/tutorials/tree/master/spring-sleuth

 

Monday, October 8, 2018

Spring Boot 2 - REST template project

Recently, I have a chance to work with Spring Boot, it was pretty hard for me to create Spring project without template that is ready for development. So I created a template to help me save time for next projects.

What are included in this boilerplate:

Github Repo: https://github.com/vanduc1102/spring-boot-examples/tree/master/spring-boot-2-rest-service-basic