Tracing
Distributed Tracing with Sleuth and Zipkin
10-15 min
Distributed Tracing with Sleuth and Zipkin
Distributed tracing is essential for understanding and debugging interactions between microservices. Spring Cloud Sleuth and Zipkin let you follow requests across your entire architecture.
1. Basic Configuration
1.1 Adding the Dependencies
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
1.2 Configuring Sleuth
# application.yml
spring:
application:
name: product-service
sleuth:
otel:
config:
trace-id-ratio-based: 1.0
propagation:
type: w3c
sampler:
probability: 1.0
zipkin:
base-url: http://localhost:9411
sender:
type: web
2. Configuring Zipkin
2.1 Installing Zipkin
docker run -d -p 9411:9411 openzipkin/zipkin
2.2 Configuring the Services
# application.yml
spring:
zipkin:
base-url: http://localhost:9411
sender:
type: web
service:
name: ${spring.application.name}
Comments
Comments are powered by GitHub Discussions
Sign in with GitHub to join the discussion