Home > Enterprise >  Spring Sleuth Do not generate Trace Id and span Id and not communicating with Zipkin server
Spring Sleuth Do not generate Trace Id and span Id and not communicating with Zipkin server

Time:12-17

I am trying to test spring cloud Zipkin. When I make a request to this API, it is not not generating Tracking ID or Span ID. Any idea what am I missing?

My Pom Dependencies

<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.0.0</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.tracing</groupId>
<artifactId>Zipkin-Server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Zipkin-Server</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>17</java.version>
    <spring-cloud.version>2022.0.0-RC2</spring-cloud.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
        <version>3.1.5</version>
    </dependency>
</dependencies>

My Application Properties

spring.application.name=sample-tracing
logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG
spring.zipkin.baseUrl: https://localhost:9411/
spring.sleuth.sampler.percentage=1.0

My Controller

@RestController
@Slf4j
public class HelloController {
@RequestMapping("/hello")
public String hello() {
    log.info("Enter the Hellow World Controller");
    return "Hello world";
}}

The Logs:

2022-12-15T13:24:15.514-05:00  INFO [sample-tracing,,] 10220 --- [nio-8080-exec-2] c.tracing.zs.controller.HelloController  : Enter the Hellow World Controller
2022-12-15T13:24:15.516-05:00 DEBUG [sample-tracing,,] 10220 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Completed 200 OK```

CodePudding user response:

Spring Cloud Sleuth does not work with Spring Boot 3.0. You have to migrate to Micrometer Tracing - read more here https://github.com/micrometer-metrics/tracing/wiki/Spring-Cloud-Sleuth-3.1-Migration-Guide

  • Related