springspring-bootmicroservicesspring-cloud-sleuthzipkin

Zipkin server is not showing Microservices trace


I have a Microservice A calling another Microservice B with the following pom.xml and application.properties values:

pom.xml

<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>

application.properties

spring.zipkin.base-url=http://localhost:9411/
spring.sleuth.sampler.probability=1.0
spring.zipkin.sender.type=web
spring.zipkin.collector.http.enabled=true

Zipkin server version: zipkin-server-2.12.9 Spring Boot Version: 2.7.5 Spring cloud version: 2021.0.4

Issue is that trace that Microservice A called Microservice B with the trace-ID is not getting displayed in Zipkin.

Any issue?

Trace of Microservices calling chain with trace-ID should be coming in Zipkin server


Solution

  • The problem was that RestTemplate used to call the another service was create as New.

    Solution is that create it as a bean and inject it to your code.