1 2 3 4 5 6 7 8 9 10 11 | repositories { } dependencies { compile('org.springframework.boot:spring-boot-starter') compile('org.springframework.boot:spring-boot-starter-jdbc') compile('io.zipkin.java:zipkin-server') runtime('io.zipkin.java:zipkin-autoconfigure-ui') compile('io.zipkin.java:zipkin-autoconfigure-storage-mysql') compile('mysql:mysql-connector-java') } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | server: port: 9411 docs: service: name: docs-zipkin # Spring Profiles spring: application: name: docs-zipkin-server # Http Encoding http: encoding.charset: UTF-8 encoding.enable: true encoding.force: true datasource: schema: classpath:/mysql.sql url: jdbc:mysql://127.0.0.1:3306/zipkin username: root password: password # Switch this on to create the schema on startup: initialize: true continueOnError: true zipkin: storage: type: mysql spring.profiles.active: dev |
1 2 3 4 5 6 7 8 9 10 11 | repositories { } dependencies { compile project(':demo-model') compile project(':demo-util') compile('org.springframework.boot:spring-boot-starter-web') compile('org.springframework.cloud:spring-cloud-starter-sleuth') compile('org.springframework.cloud:spring-cloud-sleuth-zipkin') } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | spring: application: name: demo-web profiles: active: dev sleuth: sampler: percentage: 1 # Percentage of logs export to zipkin server zipkin: # For enabling Zipkin Client for this Microservice enabled: true # Server Url baseUrl: http://localhost:9411 # Server Information server: port: 8080 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | @SpringBootApplication(scanBasePackages = { "com.ibm.demo" }) public class DemoWebApplication { public static void main(String[] args) { SpringApplication.run(DemoWebApplication.class, args); } @Bean public RestTemplate restTemplate() { return new RestTemplate(); } @Bean public SpanInjector<HttpServletResponse> customHttpServletResponseSpanInjector() { return new CustomHttpServletResponseSpanInjector(); } @Bean public HttpResponseInjectingTraceFilter responseInjectingTraceFilter(Tracer tracer) { return new HttpResponseInjectingTraceFilter(tracer, customHttpServletResponseSpanInjector()); } @Bean public Sampler defaultSampler() { return new AlwaysSampler(); } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |