sleuth和zipkin调试流程图(跟踪异步上传)
2020-03-06 17:51:31 0 举报
springcloud的sleuth分布式链路方案客户端异步上报zipkin源码流程图
作者其他创作
大纲/内容
org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter.Flusher
跟踪进入线程类的run方法
public void flush() { if (this.pending.isEmpty()) return; List<Span> drained = new ArrayList<>(this.pending.size()); this.pending.drainTo(drained); if (drained.isEmpty()) return; // json-encode the spans for transport byte[] json = Codec.JSON.writeSpans(drained); // NOTE: https://github.com/openzipkin/zipkin-java/issues/66 will throw instead of return null. if (json == null) { log.debug(\
初始化静态类-定时器1,初始化核心线程数为1的线程池2,spring工程启动时通过spi注入HttpZipkinSpanReporter初始化3,此线程一直异步批量抓取LinkedBlockedQueue中的元素,批量上报zipkin
java.io.Flushable#flush
此类源码如下
frush方法源码如下Calling this will flush any pending spans to the http transport on the current thread
上报调试流程图(跟踪日志异步上传)
跟踪进去postSpans方法,此方法调用zipkin的http接口
0 条评论
下一页