cat1197
cat1197

Reputation: 49

Spans not being sent to zipkin

I need to use Zipkn Serve to trace my spring boot application.Here is my configurations of application.yml

spring:
  cloud:
   config:
     uri: http://localhost:8080
     profiles:
      active: default
management:
  security:
    enabled: false
   zipkin:
   base-url: http://localhost:8082
   sleuth:
sampler:
  percentage: 1.0
logging:
  level:
    org:
      springframework:
       cloud:
        sleuth: WARN

But the spans not being created in Zipkin.I have added all the required dependencies to my service's pom file.

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

and the zipkin service's pom file.

<dependency>
    <groupId>io.zipkin.java</groupId>
    <artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
    <groupId>io.zipkin.java</groupId>
    <artifactId>zipkin-autoconfigure-ui</artifactId>
    <scope>runtime</scope>
</dependency>

Upvotes: 1

Views: 4412

Answers (2)

MyTwoCents
MyTwoCents

Reputation: 7622

There are 2 approaches to this

  1. Start Zipkin server with SpringBootApplication
  2. Start Zipkin server as a standalone and add url in SpringBootServer

Looking at your yml file you have added

zipkin:
   base-url: http://localhost:8082

which means your approach is 2.

But then in your pom, you have added zipkin-server and zipkin-autoconfigure-ui dependencies which is not required.

I will try to separate both setups

1. To Start Zipkin server with SpringBootApplication

pom.xml

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


  <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-server</artifactId>
    </dependency>
    <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-autoconfigure-ui</artifactId>
        <scope>runtime</scope>
    </dependency>

application.properties

spring.application.name=zipkin-server
server.port=9411

Application.java

@SpringBootApplication
@EnableZipkinStreamServe
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(ZipkinServerApplication.class, args);
    }
}

2. To Start Zipkin server as a standalone and use SpringBootApplication as Zipkin Client

Start Zipkin server

pom.xml

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

application.properties

spring.zipkin.base-url=http://localhost:9411/
spring.sleuth.sampler.probability=1

Edit 1:

@EnableZipkinServer is deprecated and unsupported as per Brian Devins's comment. So, please go through the doc for more detail info.

Upvotes: 3

Brian Devins-Suresh
Brian Devins-Suresh

Reputation: 114

I can say your YAML has some bad indentation and things are not in the right sections even. Otherwise though, you are trying to run Zipkin in an unsupported configuration. Please check out our quickstart documentation: https://zipkin.io/pages/quickstart.html

Upvotes: 0

Related Questions