zipkin搭建可参照官方提供的https://github.com/openzipkin/zipkin/tree/master/zipkin-server
基于spring boot,jdk8
默认是存储在内存中,支持mysql、Cassandra 等数据库
在生产环境中,由于日志量比较大,不必所有请求都采集,可控制采集的速率,在brave中设置
public Brave brave(SpanCollector spanCollector){ Brave.Builder builder = new Brave.Builder(properties.getServiceName()); //指定state builder.spanCollector(spanCollector); builder.traceSampler(Sampler.create(0.5f)); Brave brave = builder.build(); return brave; }
日志量就不会太大,又达到我们检查链路日志的要求
参考资料有
http://www.cnblogs.com/java-zhao/p/5858138.html
https://github.com/liaokailin/zipkin