zipkin2.Span.toBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中zipkin2.Span.toBuilder()方法的一些代码示例,展示了Span.toBuilder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Span.toBuilder()方法的具体详情如下:
包路径:zipkin2.Span
类名称:Span
方法名:toBuilder

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())

相关文章