diff --git a/pom.xml b/pom.xml index 1b2ef01700a83159c8baf12fe55dcedf40684021..78d27be531890d495043a2e8fa80269ceb39b254 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ springcloud-service-config-info springcloud-service-feign springcloud-service-zuul + springcloud-service-zipkin springcloud-service-consul springcloud-service-hystrix-dashboard springcloud-service-hystrix-turbine diff --git a/springcloud-service-config-info/dev/application-goods9100.yaml b/springcloud-service-config-info/dev/application-goods9100.yaml index 3b367232c6333a26561511a907e821d467149211..97a39bdda03812e31ade66df99f8f0d8f39a4d17 100644 --- a/springcloud-service-config-info/dev/application-goods9100.yaml +++ b/springcloud-service-config-info/dev/application-goods9100.yaml @@ -8,6 +8,11 @@ spring: password: 716288qwe application: name: goods-service #服务名称 + zipkin: + base-url: http://localhost:9411 #zipkin地址 默认值就是0.1,代表收集10%的请求追踪信息。 + sleuth: + sampler: + percentage: 0.1 #收集百分比 #服务提供者 eureka: diff --git a/springcloud-service-config-info/dev/application-goods9200.yaml b/springcloud-service-config-info/dev/application-goods9200.yaml index 881086a6c016d71149081ae11c996c2267b52344..bb7cf2559b10b4e7dc68e2addc1dd63ed701d912 100644 --- a/springcloud-service-config-info/dev/application-goods9200.yaml +++ b/springcloud-service-config-info/dev/application-goods9200.yaml @@ -7,7 +7,13 @@ spring: username: root password: 716288qwe application: - name: goods-service #服务名称 + name: goods-service #服务名 + zipkin: + base-url: http://localhost:9411 #zipkin地址 默认值就是0.1,代表收集10%的请求追踪信息。 + sleuth: + sampler: + percentage: 0.1 #收集百分比 + #服务提供者 eureka: diff --git a/springcloud-service-config-info/dev/application-goods9300.yaml b/springcloud-service-config-info/dev/application-goods9300.yaml index 5e214f193bbdcd5c1c86bf17e5a6bc42c180eaec..13e2bacab550cb3726a5d1c37ebfc437d6bcfded 100644 --- a/springcloud-service-config-info/dev/application-goods9300.yaml +++ b/springcloud-service-config-info/dev/application-goods9300.yaml @@ -8,6 +8,11 @@ spring: password: 716288qwe application: name: goods-service #服务名称 + zipkin: + base-url: http://localhost:9411 #zipkin地址 默认值就是0.1,代表收集10%的请求追踪信息。 + sleuth: + sampler: + percentage: 0.1 #收集百分比 #服务提供者 eureka: diff --git a/springcloud-service-config-info/dev/application-portal8080.yaml b/springcloud-service-config-info/dev/application-portal8080.yaml index 0542506d9fb590e1c8ac25835a74ab871fb0bd2a..4c9f68512af8a491b975646956e63543dad1d72e 100644 --- a/springcloud-service-config-info/dev/application-portal8080.yaml +++ b/springcloud-service-config-info/dev/application-portal8080.yaml @@ -1,8 +1,11 @@ spring: application: name: portal-service #服务名称 - -#服务提供者 + zipkin: + base-url: http://localhost:9411 #zipkin地址 默认值就是0.1,代表收集10%的请求追踪信息。 + sleuth: + sampler: + percentage: 0.1 #收集百分比 eureka: client: service-url: diff --git a/springcloud-service-config-info/dev/application-portal8081.yaml b/springcloud-service-config-info/dev/application-portal8081.yaml index d9ba0e4b1b7e6ff2636262570fc3d59f6e17939f..0666a247de2fca86ea9e4c33f2ba21d6bd075002 100644 --- a/springcloud-service-config-info/dev/application-portal8081.yaml +++ b/springcloud-service-config-info/dev/application-portal8081.yaml @@ -1,6 +1,11 @@ spring: application: name: portal-service #服务名称 + zipkin: + base-url: http://localhost:9411 #zipkin地址 默认值就是0.1,代表收集10%的请求追踪信息。 + sleuth: + sampler: + percentage: 0.1 #收集百分比 #服务提供者 eureka: diff --git a/springcloud-service-zipkin/pom.xml b/springcloud-service-zipkin/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..47da53c080641fa6ca1aed73054e0b0a7a5c91be --- /dev/null +++ b/springcloud-service-zipkin/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + com.kwan.springcloud + springcloud-service-parent + 1.0.0 + + springcloud-service-zipkin + 0.0.1-SNAPSHOT + springcloud-service-zipkin + + 1.8 + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.zipkin.java + zipkin-server + 2.10.4 + + + org.springframework.boot + spring-boot-starter-log4j2 + + + + + io.zipkin.java + zipkin-autoconfigure-ui + 2.10.4 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/springcloud-service-zipkin/src/main/java/com/kwan/springcloud/ZipkinApplication.java b/springcloud-service-zipkin/src/main/java/com/kwan/springcloud/ZipkinApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..c0b6a4c048b56de666aef1c3af61bc9ba299cd2d --- /dev/null +++ b/springcloud-service-zipkin/src/main/java/com/kwan/springcloud/ZipkinApplication.java @@ -0,0 +1,25 @@ +package com.kwan.springcloud; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import zipkin2.server.internal.EnableZipkinServer; + + +/** + * http:/localhost:9411/zipkin + * + * @author : qinyingjie + * @version : 2.2.0 + * @date : 2023/1/16 10:02 + */ +@EnableZipkinServer +@SpringBootApplication +public class ZipkinApplication { + + public static void main(String[] args) { + + SpringApplication.run(ZipkinApplication.class, args); + } + +} diff --git a/springcloud-service-zipkin/src/main/resources/application.yaml b/springcloud-service-zipkin/src/main/resources/application.yaml new file mode 100644 index 0000000000000000000000000000000000000000..65e3163af0fb35478be203a4a868824cd1ab9545 --- /dev/null +++ b/springcloud-service-zipkin/src/main/resources/application.yaml @@ -0,0 +1,12 @@ +#端口号 +server: + port: 9411 +#spring 相关配置 +spring: + application: + name: zipkin-service +#注册中心 +eureka: + client: + service-url: + defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/ diff --git a/springcloud-service-zipkin/src/test/java/com/kwan/springcloud/ZipkinApplicationTests.java b/springcloud-service-zipkin/src/test/java/com/kwan/springcloud/ZipkinApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..12bef34558930b6b81382b65c84979268c19703b --- /dev/null +++ b/springcloud-service-zipkin/src/test/java/com/kwan/springcloud/ZipkinApplicationTests.java @@ -0,0 +1,13 @@ +package com.kwan.springcloud; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ZipkinApplicationTests { + + @Test + void contextLoads() { + } + +}