【发布时间】:2020-08-12 21:03:13
【问题描述】:
如何强制 Zipkin span 可导出? 在下面的代码中,span 有时是可导出的,有时不是不可重复的。
在我看来,如果我评论第一个 scopedSpan,则第二个手动创建的 spanInScope 是可导出的,但第一个 scopedSpan 如何防止第二个 spanInScope 可导出?它们是如何干扰的?
@SneakyThrows
private void debugScopedSpan(final String label) {
ScopedSpan scopedSpan = tracer.startScopedSpan(label + "_1").tag("type", "manual");
try {
log.info("===== debugScopedSpan_1 {}", label);
} catch (RuntimeException | Error e) {
scopedSpan.error(e);
throw e;
} finally {
scopedSpan.finish();
}
// Why both above scopedSpan and below spanInScope cant be exportable at the same time??? How do they iterfere with each other?
Span trace = tracer.nextSpan().name(label+"_2").tag("type", "manual").start();
final Tracer.SpanInScope spanInScope = tracer.withSpanInScope(trace);
log.info("===== debugScopedSpan_2 {}", label);
spanInScope.close();
trace.finish();
}
【问题讨论】:
标签: spring-cloud-sleuth zipkin