-
Notifications
You must be signed in to change notification settings - Fork 965
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Introducing new features.add zipkin
- Loading branch information
Showing
11 changed files
with
293 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
spring: | ||
# 数据源 | ||
datasource: | ||
type: com.zaxxer.hikari.HikariDataSource | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: root | ||
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai | ||
management: | ||
metrics: | ||
web: | ||
server: | ||
auto-time-requests: false | ||
zipkin: | ||
storage: | ||
type: mysql | ||
sleuth: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM anapsix/alpine-java:8_server-jre_unlimited | ||
|
||
MAINTAINER wangiegie@gmail.com | ||
|
||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
|
||
RUN mkdir -p /pig-zipkin | ||
|
||
WORKDIR /pig-zipkin | ||
|
||
EXPOSE 5002 | ||
|
||
ADD ./pig-visual/pig-zipkin/target/pig-zipkin.jar ./ | ||
|
||
CMD java -Djava.security.egd=file:/dev/./urandom -jar pig-zipkin.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?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>pig-visual</artifactId> | ||
<groupId>com.pig4cloud</groupId> | ||
<version>2.0.2</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>pig-zipkin</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<description>pig 服务链路跟踪模块,基于zipkin</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<exclusions> | ||
<!--排除tomcat依赖--> | ||
<exclusion> | ||
<artifactId>spring-boot-starter-tomcat</artifactId> | ||
<groupId>org.springframework.boot</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-undertow</artifactId> | ||
</dependency> | ||
<!--配置中心客户端--> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-config</artifactId> | ||
</dependency> | ||
<!--jdbc相关--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
</dependency> | ||
<!--zipkin--> | ||
<dependency> | ||
<groupId>io.zipkin.java</groupId> | ||
<artifactId>zipkin-server</artifactId> | ||
<version>${zipkin.version}</version> | ||
<!--排除log4j2 避免和logback冲突警告--> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-log4j2</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.zipkin.java</groupId> | ||
<artifactId>zipkin-autoconfigure-ui</artifactId> | ||
<version>${zipkin.version}</version> | ||
</dependency> | ||
<!-- 使用mysql存储--> | ||
<dependency> | ||
<groupId>io.zipkin.java</groupId> | ||
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId> | ||
<version>${zipkin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.zipkin.java</groupId> | ||
<artifactId>zipkin-storage-mysql</artifactId> | ||
<version>${zipkin-storage-mysql.version}</version> | ||
</dependency> | ||
<!-- zipkin2.x 需要此包连接操作mysql --> | ||
<dependency> | ||
<groupId>org.jooq</groupId> | ||
<artifactId>jooq</artifactId> | ||
<version>${jooq.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.spotify</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
pig-visual/pig-zipkin/src/main/java/com/pig4cloud/pig/zipkin/PigZipkinApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.pig4cloud.pig.zipkin; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.cloud.client.SpringCloudApplication; | ||
import org.springframework.context.annotation.Bean; | ||
import zipkin.storage.mysql.MySQLStorage; | ||
import zipkin2.server.internal.EnableZipkinServer; | ||
|
||
import javax.sql.DataSource; | ||
|
||
/** | ||
* 服务链路追踪 | ||
* | ||
* @author lishangbu | ||
* @date 2019/2/23 | ||
*/ | ||
@EnableZipkinServer | ||
@SpringCloudApplication | ||
public class PigZipkinApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(PigZipkinApplication.class, args); | ||
} | ||
@Bean | ||
public MySQLStorage mySQLStorage(DataSource datasource) { | ||
return MySQLStorage.builder().datasource(datasource).executor(Runnable::run).build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
${AnsiColor.BRIGHT_YELLOW} | ||
|
||
::::::::: ::::::::::: :::::::: | ||
:+: :+: :+: :+: :+: | ||
+:+ +:+ +:+ +:+ | ||
+#++:++#+ +#+ :#: | ||
+#+ +#+ +#+ +#+# | ||
#+# #+# #+# #+# | ||
### ########### ######## | ||
|
||
www.pig4cloud.com | ||
|
||
Pig Microservice Architecture | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
server: | ||
port: 5002 | ||
|
||
spring: | ||
application: | ||
name: pig-zipkin | ||
profiles: | ||
active: dev | ||
#配置中心 | ||
cloud: | ||
config: | ||
fail-fast: true | ||
name: ${spring.application.name} | ||
profile: ${spring.profiles.active} | ||
discovery: | ||
enabled: true | ||
service-id: pig-config | ||
# 注册中心配置 | ||
eureka: | ||
instance: | ||
prefer-ip-address: true | ||
client: | ||
service-url: | ||
defaultZone: http://pig:pig@pig-eureka:8761/eureka/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters