[] Spring Cloud Spring Cloud of Zipkin server and HTTP to build the collection, tracking of distributed services (2)

First, build step

1) New Spring Boot project, coordinates the introduction of pom

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <dependencies>
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-server</artifactId>
            <version>2.10.3</version>
        </dependency>
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-ui</artifactId>
            <version>2.10.3</version>
        </dependency>
    </dependencies>

2) increase related configuration

spring.application.name: Base -zipkin- Server 
server.port: 9411 

#zipkin start Solution error inaccessible 
management.metrics.web.server.auto -time-Requests: false

3) increase the startup class notes

@EnableZipkinServer
@SpringBootApplication
public class BaseZipkinServerApplication {

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

}

 

Second, application services how to http way to send sleuth generated traceId and other data to track the Zipkin

Http is the default way to send the relevant configuration is as follows

1) increase pom coordinates

          <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-sleuth-zipkin</artifactId>
                <version>2.0.3.RELEASE</version>
            </dependency>

Note that this version is 2.0.3.RELEASE, we need to Zipkin version of the server version of the dependent parent should try to 2.0.3.RELEASE. Because the transfer of data to track the situation there is the interface upgrades, such as

When Zipkin Server version 1.5, the interface address / api / v1 / spans, version 2.0, the interface address / api / v2 / spans. Here are just a rough version of Kazakhstan.
Also note that, the coordinate Maven coordinates can not spring-boot-starter-amqp, otherwise the HTTP will not collect, but to collect the message queue, the following coordinates:

        <!--amqp-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>

 

2) increase the allocation, the specified address Zipkin services,

spring:
  zipkin:
    base-url=http://localhost:9411:management:

 

Guess you like

Origin www.cnblogs.com/756623607-zhang/p/11520214.html