• sleuth zipkin链路追踪


    <project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.tszr.consumer</groupId>
        <artifactId>mango-consumer</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>mango-consumer</name>
        <description>mango-consumer</description>
        
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.3.RELEASE</version>
        </parent>
        
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <swagger.version>2.9.2</swagger.version>
            <mybatis.spring.version>1.3.2</mybatis.spring.version>
            <spring.boot.admin.version>2.0.3</spring.boot.admin.version>
            <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
        </properties>
        
        <dependencies>
            <!-- web -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <!-- swagger -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <!--spring-boot-admin-->
               <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-starter-client</artifactId>
                <version>${spring.boot.admin.version}</version>
            </dependency>
            <!--consul-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-consul-discovery</artifactId>
            </dependency>
            <!--feign -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-openfeign</artifactId>
            </dependency>
            <!--test-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
            
            <!--actuator-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <!--hystrix-dashboard-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
            </dependency>
            
            <!-- zipkin -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-zipkin</artifactId>
            </dependency>
        </dependencies>
    
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>${spring-cloud.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
        
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>11</source>
                        <target>11</target>
                    </configuration>
                </plugin>
                
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </project>
    server:
      port: 8005
    spring:
      application:
        name: mango-consumer
      cloud:
        consul:
          host: localhost
          port: 8500
          discovery:
            serviceName: ${spring.application.name}    # 注册到consul的服务名称
      boot:
        admin:
          client:
            url: "http://localhost:8003"
      zipkin:
        base-url: http://localhost:9411/
      sleuth:
        sampler:
          probability: 1 #样本采集量,默认为0.1,为了测试这里修改为1,正式环境一般使用默认值。
    # 开放健康检查接口
    management:
      endpoints:
        web:
          exposure:
            include: "*"
      endpoint:
        health:
          show-details: ALWAYS
          
    #开启熔断器
    feign:
      hystrix:
        enabled: true

     

  • 相关阅读:
    app-授权登录插件配置
    微信公众号-公众号设置-功能设置
    Java变量
    Java数据类型
    计算机存储单元
    Java常量
    k8s
    第一个Java程序
    旋转木马
    tools
  • 原文地址:https://www.cnblogs.com/tszr/p/15948376.html
Copyright © 2020-2023  润新知