1

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.

Praneeth Kumar
  • 284
  • 1
  • 15
  • set type=kafka instead of type:kafka? You can try to run your app with -Ddebug=true to get more info – Marcin Grzejszczak Sep 11 '19 at 17:16
  • Hey thanks for the reply Im sorry I made a typo while writing the question, In my application it is spring.zipkin.sender.type=kafka only but it still ain't showing logs – Praneeth Kumar Sep 11 '19 at 18:21
  • The traces are going into Kafka as I'm running a consumer which is consuming the topic zipkin and whenever I hit any endpoint the log is being generated and it is being displayed in the consumer cmd line,but it is not going to Zipkin – Praneeth Kumar Sep 11 '19 at 18:31
  • 1
    Thanks for your help @MarcinGrzejszczak, I wish I specified my command line terminals too, and then maybe you would have instantly figured out what my problem was. Anyway, I really appreciate the help and hope to see a new video on youtube on Microservices tracing with Spring Cloud and Zipkin in spring cloud Greenwich.SR2 release. – Praneeth Kumar Sep 12 '19 at 17:25

1 Answers1

2

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

Praneeth Kumar
  • 284
  • 1
  • 15