Spring Boot 4 Microservices & REST APIs · Lezione

Esportare le trace in Zipkin

Visualizzi le trace in Zipkin.

Lezione 3 di 413 passaggi

Esportare le trace in Zipkin è una lezione Spring Boot 4 Microservices & REST APIs gratuita su CoddyKit. Questa è la lezione 3 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Spring Boot 4 Microservices & REST APIs, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Spring Boot 4 Microservices & REST APIs include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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
Gratis per iniziare

Impara Java con un tutor IA — gratis

Scrivi ed esegui vero codice nel tuo browser, ricevi aiuto istantaneo da un tutor IA disponibile 24/7, e riprendi da dove hai lasciato sul web o nell'app.

Corsi
24
Lezioni
93

Domande Frequenti

La lezione «Esportare le trace in Zipkin» è gratuita?

Sì — il testo completo di «Esportare le trace in Zipkin» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Spring Boot 4 Microservices & REST APIs, passa a CoddyKit PRO. Il corso Spring Boot 4 Microservices & REST APIs include 4 lezioni in totale.

Cosa imparerò in «Esportare le trace in Zipkin»?

Visualizzi le trace in Zipkin. Eserciti Spring Boot 4 Microservices & REST APIs con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Spring Boot 4 Microservices & REST APIs?

Non è richiesta alcuna esperienza precedente. Spring Boot 4 Microservices & REST APIs su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 3 di 4.

Quanto tempo richiede la lezione «Esportare le trace in Zipkin»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Spring Boot 4 Microservices & REST APIs?

Sì. Ogni lezione Spring Boot 4 Microservices & REST APIs include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Perché il tracing distribuito è importante
  2. Micrometer Tracing
  3. Esportare le trace in Zipkin
  4. Correlare log e trace
← Torna a Spring Boot 4 Microservices & REST APIs