博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
springboot+zipkin+docker实例
阅读量:5864 次
发布时间:2019-06-19

本文共 4584 字,大约阅读时间需要 15 分钟。

zipkin-server

  • pom

io.zipkin
zipkin-ui
1.39.3
org.springframework.boot
spring-boot-starter-jdbc
org.springframework.cloud
spring-cloud-sleuth-zipkin-stream
1.0.0.RELEASE
org.springframework.cloud
spring-cloud-starter-stream-rabbit
1.0.0.RELEASE
com.h2database
h2
  • application.yaml

spring:  rabbitmq:    addresses: rabbitmq#  datasource:#      #脚本位置:依赖spanstore-jdbc-0.9.3.jar内##    schema: classpath:/mysql.sql#    url: jdbc:mysql://zipkin_mysql:3306/zipkin#    username: zipkin#    password: zipkin#      # Switch this on to create the schema on startup:#    initialize: true#    continueOnError: true  sleuth:   # not use sleuth stream to trace zipkin server itself    enabled: false    #refer to org.springframework.cloud.sleuth.instrument.hystrix.SleuthHystrixAutoConfiguration.java    hystrix:      strategy:        enabled: falsezipkin:  storage:    type: mem #mysql #mem
  • application

@EnableZipkinStreamServer@SpringBootApplicationpublic class ZipkinServerApplication {    public static void main(String[] args){        SpringApplication.run(ZipkinServerApplication.class,args);    }}

zipkin-client

  • pom

org.springframework.boot
spring-boot-starter-aop
org.springframework.cloud
spring-cloud-sleuth-stream
1.0.0.RELEASE
org.springframework.cloud
spring-cloud-starter-stream-rabbit
1.0.0.RELEASE
org.springframework.cloud
spring-cloud-starter-ribbon
1.0.6.RELEASE
io.reactivex
rxjava
io.reactivex
rxjava
1.1.5
  • application.yml

spring:# mq stream format to send trace data  rabbitmq:    addresses: rabbitmq  #zipkin config  zipkin:      #defult is true,to use zipkin,false:not use    enabled: true    baseUrl: http://zipkin:9411/    sleuth:      sampler:        # 采样率,默认0.1即10%,如需测试时每次都看到trace则修改为1.0,但对性能有影响,注意上线时修改为合理值        percentage: 1.0      hystrix:        strategy:          enabled: true      #https://github.com/ReactiveX/RxJava/issues/2297      rxjava:        schedulers:          hook:            enabled: false      # stream format  to send trace msg: enable sleuth.stream to use stream      # default is true,refer to SleuthStreamAutoConfiguration.java      stream:        enabled: true      # skip tracing urls' pattern,refer to org.springframework.cloud.sleuth.instrument.web.TraceWebAutoConfiguration      #web:        #skipPattern: /eureka.*# zipkin properties for ServiceApplication.java to debug when there is no zipkin serversample:  zipkin:    # When enabled=false, traces log to the console. Comment to send to zipkin    enabled: true
  • application

@SpringBootApplication@EnableDiscoveryClient@EnableFeignClients@EnableCircuitBreaker@EnableHystrix@EnableHystrixDashboard@EnableAspectJAutoProxy(proxyTargetClass = true)@EnableAsyncpublic class TraceDemoApplication {    @Bean    Sampler sampler() {        return new AlwaysSampler();    }    public static void main(String[] args){        SpringApplication.run(TraceDemoApplication.class,args);    }}

docker-compose

rabbitmq:  image: rabbitmq:management  expose:    - 5672    - 15672  ports:    - 5672:5672    - 15672:15672zipkin:  image: zipkin-server  restart: always  ports:   # Listen port for the Scribe transport      - "9410:9410"        # Historical port used for the Zipkin HTTP Api      - "9411:9411"      - "9901:9901"  links:    - rabbitmqtrace_demo:  image: trace-demo  restart: always  ports:    - "9998:9998"  links:    - discovery    - config    - rabbitmq    - zipkin

运行

clipboard.png

查询

clipboard.png

参考

  • (推荐)

  • (推荐)

转载地址:http://mrynx.baihongyu.com/

你可能感兴趣的文章
新手用不起,高手看不上系列之--MVVMHabit
查看>>
一次幸运的校招小米Java后台offer
查看>>
时序数据库连载系列: 时序数据库一哥InfluxDB之存储机制解析
查看>>
Java架构-不要成为项目风险的奴隶
查看>>
mybatis原理,配置介绍及源码分析
查看>>
Cordova+Vue开发Android应用
查看>>
HTTP协议类
查看>>
安利软件-如何一键装B
查看>>
征名公布|Qtum量子链企业版—Unita 中文名征集圆满落幕
查看>>
MySQL查询优化
查看>>
Jenkins 构建 Exec timeout!
查看>>
HttpCanary使用指南——静态注入器
查看>>
MQTT 入门
查看>>
Android Studio出现“Cannot resolve symbol XXXX”???
查看>>
探索webpack热更新对代码打包结果的影响(二)
查看>>
Android中XML的解析--使用PULL
查看>>
三、Android性能优化之常见的内存泄漏分析
查看>>
看不见的战斗——阿里云护航世界杯直播容灾实践
查看>>
搜遍整个淘宝,这8家礼物店最值得收藏!
查看>>
scss、sass 全局变量
查看>>