التتبع
التتبع الموزّع باستخدام Sleuth وZipkin
10-15 دقيقة
التتبع الموزّع باستخدام Sleuth وZipkin
يُعدّ التتبع الموزّع أمرًا أساسيًا لفهم التفاعلات بين الخدمات المصغّرة وتصحيح أخطائها. يتيح كلٌّ من Spring Cloud Sleuth وZipkin تتبع الطلبات عبر البنية المعمارية بأكملها.
1. الإعداد الأساسي
1.1 إضافة الاعتماديات
<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 إعداد 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. إعداد Zipkin
2.1 تثبيت Zipkin
docker run -d -p 9411:9411 openzipkin/zipkin
2.2 إعداد الخدمات
# application.yml
spring:
zipkin:
base-url: http://localhost:9411
sender:
type: web
service:
name: ${spring.application.name}
التعليقات
التعليقات مدعومة عبر GitHub Discussions
سجّل الدخول باستخدام GitHub للمشاركة في النقاش