本文整理了Java中zipkin2.Span.toBuilder()
方法的一些代码示例,展示了Span.toBuilder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Span.toBuilder()
方法的具体详情如下:
包路径:zipkin2.Span
类名称:Span
方法名:toBuilder
暂无
代码示例来源:origin: openzipkin/brave
protected Tracing.Builder tracingBuilder(Sampler sampler) {
return Tracing.newBuilder()
.spanReporter(s -> {
// make sure the context was cleared prior to finish.. no leaks!
TraceContext current = httpTracing.tracing().currentTraceContext().get();
boolean contextLeak = false;
if (current != null) {
// add annotation in addition to throwing, in case we are off the main thread
if (current.spanIdString().equals(s.id())) {
s = s.toBuilder().addAnnotation(s.timestampAsLong(), CONTEXT_LEAK).build();
contextLeak = true;
}
}
spans.add(s);
// throw so that we can see the path to the code that leaked the context
if (contextLeak) {
throw new AssertionError(CONTEXT_LEAK + " on " + Thread.currentThread().getName());
}
})
.propagationFactory(ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, EXTRA_KEY))
.currentTraceContext(currentTraceContext)
.sampler(sampler);
}
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
replacement = span.toBuilder().traceId(traceId);
if (replacement == null) replacement = span.toBuilder();
replacement.merge(next);
if (replacement == null) replacement = span.toBuilder();
replacement.shared(true);
if (replacement == null) replacement = span.toBuilder();
replacement.parentId(last.parentId());
代码示例来源:origin: io.zipkin.brave/brave-instrumentation-http-tests
protected Tracing.Builder tracingBuilder(Sampler sampler) {
return Tracing.newBuilder()
.spanReporter(s -> {
// make sure the context was cleared prior to finish.. no leaks!
TraceContext current = httpTracing.tracing().currentTraceContext().get();
boolean contextLeak = false;
if (current != null) {
// add annotation in addition to throwing, in case we are off the main thread
if (current.spanIdString().equals(s.id())) {
s = s.toBuilder().addAnnotation(s.timestampAsLong(), CONTEXT_LEAK).build();
contextLeak = true;
}
}
spans.add(s);
// throw so that we can see the path to the code that leaked the context
if (contextLeak) {
throw new AssertionError(CONTEXT_LEAK + " on " + Thread.currentThread().getName());
}
})
.propagationFactory(ExtraFieldPropagation.newFactory(B3Propagation.FACTORY, EXTRA_KEY))
.currentTraceContext(currentTraceContext)
.sampler(sampler);
}
}
代码示例来源:origin: openzipkin/zipkin-finagle
.build();
Span span2 = span1.toBuilder()
.kind(Span.Kind.CLIENT)
.parentId(FinagleTestObjects.child.parentId().toLong())
内容来源于网络,如有侵权,请联系作者删除!