Search code examples
springspring-bootapache-kafkaspring-cloudzipkin

traces are not being shown in zipkin, when sender type is kafka


I want to send my spring boot log traces using Kafka to Zipkin server

I started my Kafka and Zipkin servers and I started a Kafka consumer which is listening to the topic Zipkin and I am able to see my logs here but when I open my Zipkin dashboard I can't find any traces

Spring boot version :- 2.1.7.RELEASE
Spring Cloud version :- Greenwich.SR2

depedendency Management

    <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>Greenwich.SR2</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>

dependencies

    <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
     <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
    </dependency>
    <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
    </dependency>

My application.properties file

        spring.sleuth.sampler.probability=1 

        spring.application.name=dummy

        spring.zipkin.baseUrl=http://localhost:9411

        spring.zipkin.sender.type=kafka

SpringBootApplication Main file

@SpringBootApplication
public class UserApplication {

    public static void main(String[] args) {
        SpringApplication.run(UserApplication.class, args);
    }

}

My Controller function

@GetMapping("/hello")
public String sayHello() {
    log.info("hey im a log");
    return "hello";
}

when i make spring.zipkin.sender.type=web the traces are being shown in Zipkin dashboard Is there anything I'm missing here.


Solution

  • ok I finally realized whats the mistake that I have done when I was starting my zipkin server with this command

     java -jar zipkin-server-2.16.2-exec.jar
    

    but I was not specifying my Zipkin server where my Kafka is running so when I did

     set KAFKA_BOOTSTRAP_SERVERS=localhost:9092
     java -jar zipkin-server-2.16.2-exec.jar 
    

    it worked