Spring Boot 4 Microservices & REST APIs · บทเรียน

การส่งออกการติดตามไปยัง Zipkin

แสดงภาพการติดตามใน Zipkin

บทเรียน 3 จาก 413 ขั้นตอน

การส่งออกการติดตามไปยัง Zipkin เป็นบทเรียน Spring Boot 4 Microservices & REST APIs ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Spring Boot 4 Microservices & REST APIs และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Spring Boot 4 Microservices & REST APIs มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Why an exporter is needed

Creating spans is not enough - they must be exported to a backend that stores and visualizes them. Zipkin is a popular, easy-to-run choice.

Running Zipkin

The simplest way to run Zipkin locally is its Docker image. It exposes a UI and an ingest API on port 9411.

// docker run -d -p 9411:9411 openzipkin/zipkin
// UI at http://localhost:9411

Adding the Zipkin reporter

Add the reporter dependency so finished spans are sent to Zipkin.

<dependency>
  <groupId>io.zipkin.reporter2</groupId>
  <artifactId>zipkin-reporter-brave</artifactId>
</dependency>

Configuring the endpoint

Tell Spring where Zipkin lives. The default endpoint is the local Zipkin ingest URL.

management:
  zipkin:
    tracing:
      endpoint: http://localhost:9411/api/v2/spans

Setting the sampling rate

Combine the exporter with a sampling probability. In development you often sample 100% to see every trace.

management:
  tracing:
    sampling:
      probability: 1.0   # 100% in dev

Service name in Zipkin

Spans are grouped by service. Zipkin uses spring.application.name as the service name, so set it meaningfully on each app.

spring:
  application:
    name: order-service

How spans reach Zipkin

Each service buffers finished spans and reports them to Zipkin asynchronously (over HTTP by default). Zipkin joins spans sharing a traceId into one trace.

Exploring traces in the UI

In the Zipkin UI you search by service, span name, tag or duration, then open a trace to see the waterfall of spans across all services.

Reading the dependency graph

Zipkin can render a service dependency diagram from collected traces, showing which services call which - a live map of your architecture.

Alternative backends

The same Micrometer setup can export elsewhere. With the OpenTelemetry bridge you can send to OTLP-compatible backends (Tempo, Jaeger, vendors) instead of Zipkin.

Production considerations

In production, lower the sampling rate, secure the Zipkin endpoint, and ensure the reporter's async queue does not drop too many spans under load. Tracing should never harm request latency.

Quick Check

Confirm your exporter knowledge.

Recap

You exported traces to Zipkin:

  • Run Zipkin (port 9411) and add the Zipkin reporter
  • Set the endpoint and a sampling probability
  • spring.application.name is the Zipkin service name
  • Explore waterfalls and the service dependency graph in the UI
เริ่มต้นได้ฟรี

เรียนรู้ Java ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
24
บทเรียน
93

คำถามที่พบบ่อย

บทเรียน “การส่งออกการติดตามไปยัง Zipkin” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การส่งออกการติดตามไปยัง Zipkin” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Spring Boot 4 Microservices & REST APIs ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Spring Boot 4 Microservices & REST APIs มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การส่งออกการติดตามไปยัง Zipkin”

แสดงภาพการติดตามใน Zipkin คุณปฏิบัติ Spring Boot 4 Microservices & REST APIs ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Spring Boot 4 Microservices & REST APIs หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Spring Boot 4 Microservices & REST APIs บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “การส่งออกการติดตามไปยัง Zipkin” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Spring Boot 4 Microservices & REST APIs นี้ได้ไหม

ได้ บทเรียน Spring Boot 4 Microservices & REST APIs ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. เหตุผลที่การติดตามแบบกระจายมีความสำคัญ
  2. การติดตามด้วย Micrometer
  3. การส่งออกการติดตามไปยัง Zipkin
  4. การเชื่อมโยงบันทึกกับการติดตาม
← กลับไปที่ Spring Boot 4 Microservices & REST APIs