🎉 2.5.3.RELEASE 集成分布式链路追踪

This commit is contained in:
smallchill 2019-11-03 22:13:02 +08:00
parent a8b10d57ff
commit e6c7eb6530
30 changed files with 261 additions and 29 deletions

View File

@ -1,9 +1,9 @@
<p align="center">
<img src="https://img.shields.io/badge/Release-V2.5.2-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Release-V2.5.3-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR3-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.8.RELEASE-blue.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.9.RELEASE-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
</a>

View File

@ -8,7 +8,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<artifactId>blade-auth</artifactId>
@ -54,6 +54,11 @@
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!--Zipkin-->
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>-->
</dependencies>
<build>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -39,6 +39,21 @@ public interface CommonConstant {
*/
String SENTINEL_TEST_ADDR = "172.30.0.58:8858";
/**
* zipkin dev 地址
*/
String ZIPKIN_DEV_ADDR = "http://127.0.0.1:9411";
/**
* zipkin prod 地址
*/
String ZIPKIN_PROD_ADDR = "http://172.30.0.58:9411";
/**
* zipkin test 地址
*/
String ZIPKIN_TEST_ADDR = "http://172.30.0.58:9411";
/**
* sword 系统名
*/
@ -101,4 +116,21 @@ public interface CommonConstant {
}
}
/**
* 动态获取zipkin地址
*
* @param profile 环境变量
* @return addr
*/
static String zipkinAddr(String profile) {
switch (profile) {
case (AppConstant.PROD_CODE):
return ZIPKIN_PROD_ADDR;
case (AppConstant.TEST_CODE):
return ZIPKIN_TEST_ADDR;
default:
return ZIPKIN_DEV_ADDR;
}
}
}

View File

@ -34,6 +34,7 @@ public class LauncherServiceImpl implements LauncherService {
props.setProperty("spring.cloud.nacos.discovery.server-addr", CommonConstant.nacosAddr(profile));
props.setProperty("spring.cloud.nacos.config.server-addr", CommonConstant.nacosAddr(profile));
props.setProperty("spring.cloud.sentinel.transport.dashboard", CommonConstant.sentinelAddr(profile));
props.setProperty("spring.zipkin.base-url", CommonConstant.zipkinAddr(profile));
}
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -0,0 +1,15 @@
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER smallchill@163.com
RUN mkdir -p /blade/zipkin
WORKDIR /blade/zipkin
EXPOSE 9411
ADD ./target/blade-zipkin.jar ./app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-zipkin</artifactId>
<name>${project.artifactId}</name>
<version>${bladex.project.version}</version>
<packaging>jar</packaging>
<dependencies>
<!--Blade-->
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId>
<version>${blade.project.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-tool</artifactId>
<version>${blade.tool.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId>
<exclusions>
<exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-core-secure</artifactId>
</exclusion>
</exclusions>
<version>${blade.tool.version}</version>
</dependency>
<!--Zipkin-->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
<version>2.12.3</version>
<exclusions>
<exclusion>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<version>2.12.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.plugin.version}</version>
<configuration>
<imageName>${docker.registry.url}/blade/${project.artifactId}:${project.version}</imageName>
<dockerDirectory>${project.basedir}</dockerDirectory>
<dockerHost>${docker.registry.host}</dockerHost>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<registryUrl>${docker.registry.url}</registryUrl>
<serverId>${docker.registry.url}</serverId>
<pushImage>true</pushImage>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy overwrite="true"
tofile="${session.executionRootDirectory}/target/${artifactId}.jar"
file="${project.build.directory}/${artifactId}.jar" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.zipkin;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import zipkin2.server.internal.EnableZipkinServer;
/**
* Zipkin启动器
*
* @author Chill
*/
@EnableZipkinServer
@SpringBootApplication
public class ZipkinApplication {
public static void main(String[] args) {
BladeApplication.run(AppConstant.APPLICATION_ZIPKIN_NAME, ZipkinApplication.class, args);
}
}

View File

@ -0,0 +1,18 @@
server:
port: 9411
undertow:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
io-threads: 4
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
worker-threads: 20
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
buffer-size: 1024
# 是否分配的直接内存
direct-buffers: true
#zipkin启动报错无法访问的解决方法
management:
metrics:
web:
server:
auto-time-requests: false

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -17,6 +17,7 @@
<module>blade-resource</module>
<module>blade-seata-order</module>
<module>blade-seata-storage</module>
<module>blade-zipkin</module>
</modules>
</project>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,13 +5,13 @@
<parent>
<artifactId>SpringBlade</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name>
<version>2.5.2</version>
<version>2.5.3</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务API集合</description>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -30,6 +30,11 @@
<artifactId>blade-system-api</artifactId>
<version>${blade.project.version}</version>
</dependency>
<!--Zipkin-->
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>-->
</dependencies>
<build>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -31,6 +31,11 @@
<artifactId>blade-dict-api</artifactId>
<version>${blade.project.version}</version>
</dependency>
<!--Zipkin-->
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>-->
</dependencies>
<build>

View File

@ -7,12 +7,12 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
</parent>
<artifactId>blade-service</artifactId>
<name>${project.artifactId}</name>
<version>2.5.2</version>
<version>2.5.3</version>
<packaging>pom</packaging>
<description>SpringBlade 微服务集合</description>

View File

@ -5,12 +5,12 @@
<groupId>org.springblade</groupId>
<artifactId>SpringBlade</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
<packaging>pom</packaging>
<properties>
<blade.tool.version>2.5.2</blade.tool.version>
<blade.project.version>2.5.2</blade.project.version>
<blade.tool.version>2.5.3</blade.tool.version>
<blade.project.version>2.5.3</blade.project.version>
<java.version>1.8</java.version>
<swagger.version>2.9.2</swagger.version>
@ -23,7 +23,7 @@
<alibaba.cloud.version>2.1.0.RELEASE</alibaba.cloud.version>
<spring.boot.admin.version>2.1.5</spring.boot.admin.version>
<spring.boot.version>2.1.8.RELEASE</spring.boot.version>
<spring.boot.version>2.1.9.RELEASE</spring.boot.version>
<spring.cloud.version>Greenwich.SR3</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version>

View File

@ -1,2 +1,2 @@
REGISTER=192.168.0.157/blade
TAG=2.5.2
TAG=2.5.3

View File

@ -14,6 +14,7 @@ port(){
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --add-port=3379/tcp --permanent
firewall-cmd --add-port=7002/tcp --permanent
firewall-cmd --add-port=9411/tcp --permanent
service firewalld restart
}
@ -41,7 +42,7 @@ base(){
#启动程序模块
modules(){
docker-compose up -d blade-gateway1 blade-gateway2 blade-admin blade-auth1 blade-auth2 blade-user blade-desk blade-system blade-log
docker-compose up -d blade-gateway1 blade-gateway2 blade-admin blade-zipkin blade-auth1 blade-auth2 blade-user blade-desk blade-system blade-log
}
#关闭所有模块

View File

@ -71,6 +71,15 @@ services:
networks:
- blade_net
blade-zipkin:
image: "${REGISTER}/blade/blade-zipkin:${TAG}"
ports:
- 9411:9411
privileged: true
restart: always
networks:
- blade_net
blade-gateway1:
image: "${REGISTER}/blade/blade-gateway:${TAG}"
privileged: true