brave.Tracing.newBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(192)

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

Tracing.newBuilder介绍

暂无

代码示例

代码示例来源:origin: openzipkin/brave

@Override public Set<Object> getSingletons() {
  return new LinkedHashSet<>(asList(new Resource(), TracingApplicationEventListener.create(
    HttpTracing.create(Tracing.newBuilder().spanReporter(Reporter.NOOP).build())
  )));
 }
}

代码示例来源:origin: openzipkin/brave

public Unsampled() {
  super(TracingFilter.create(
    Tracing.newBuilder().sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build()
  ));
 }
}

代码示例来源:origin: openzipkin/brave

public Traced128() {
  super(TracingFilter.create(
    Tracing.newBuilder().traceId128Bit(true).spanReporter(Reporter.NOOP).build()));
 }
}

代码示例来源:origin: openzipkin/brave

public Traced() {
  super(Tracing.newBuilder()
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

@Override public Set<Object> getSingletons() {
  return new LinkedHashSet<>(asList(new Resource(), TracingApplicationEventListener.create(
    HttpTracing.create(Tracing.newBuilder()
      .sampler(Sampler.NEVER_SAMPLE)
      .spanReporter(Reporter.NOOP)
      .build())
  )));
 }
}

代码示例来源:origin: openzipkin/brave

@Override public Set<Object> getSingletons() {
  return new LinkedHashSet<>(asList(new Resource(), TracingApplicationEventListener.create(
    HttpTracing.create(Tracing.newBuilder()
      .traceId128Bit(true)
      .spanReporter(Reporter.NOOP)
      .build())
  )));
 }
}

代码示例来源:origin: line/armeria

@Test
public void newDecorator_shouldFailFastWhenRequestContextCurrentTraceContextNotConfigured() {
  assertThatThrownBy(() -> HttpTracingService.newDecorator(Tracing.newBuilder().build()))
      .isInstanceOf(IllegalStateException.class).hasMessage(
      "Tracing.currentTraceContext is not a RequestContextCurrentTraceContext scope. " +
      "Please call Tracing.Builder.currentTraceContext(RequestContextCurrentTraceContext.INSTANCE)."
  );
}

代码示例来源:origin: line/armeria

@Test
public void newDecorator_shouldFailFastWhenRequestContextCurrentTraceContextNotConfigured() {
  assertThatThrownBy(() -> HttpTracingClient.newDecorator(Tracing.newBuilder().build()))
      .isInstanceOf(IllegalStateException.class).hasMessage(
      "Tracing.currentTraceContext is not a RequestContextCurrentTraceContext scope. " +
      "Please call Tracing.Builder.currentTraceContext(RequestContextCurrentTraceContext.INSTANCE)."
  );
}

代码示例来源:origin: openzipkin/brave

public Unsampled() {
  super(Tracing.newBuilder()
    .sampler(Sampler.NEVER_SAMPLE)
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public Traced128() {
  super(Tracing.newBuilder()
    .traceId128Bit(true)
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public TracedExtra() {
  super(TracingFilter.create(Tracing.newBuilder()
    .propagationFactory(ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY)
      .addField("x-vcap-request-id")
      .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id"))
      .build()
    )
    .spanReporter(Reporter.NOOP)
    .build()));
 }
}

代码示例来源:origin: openzipkin/brave

public TracedExtra() {
  super(Tracing.newBuilder()
    .propagationFactory(ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY)
      .addField("x-vcap-request-id")
      .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id"))
      .build()
    )
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

@Setup(Level.Trial) public void init() throws MessageNotWriteableException {
 Tracing tracing = Tracing.newBuilder().spanReporter(Reporter.NOOP).build();
 producer = new FakeMessageProducer();
 message.setText("value");
 tracingProducer = TracingMessageProducer.create(producer, JmsTracing.create(tracing));
}

代码示例来源:origin: line/armeria

@Test
public void newDecorator_shouldWorkWhenRequestContextCurrentTraceContextConfigured() {
  HttpTracingService.newDecorator(
      Tracing.newBuilder().currentTraceContext(RequestContextCurrentTraceContext.DEFAULT).build());
}

代码示例来源:origin: line/armeria

@Test
public void newDecorator_shouldWorkWhenRequestContextCurrentTraceContextConfigured() {
  HttpTracingClient.newDecorator(
      Tracing.newBuilder().currentTraceContext(RequestContextCurrentTraceContext.DEFAULT).build());
}

代码示例来源:origin: openzipkin/brave

@Setup(Level.Trial) public void init() {
 Tracing tracing = Tracing.newBuilder().spanReporter(Reporter.NOOP).build();
 producer = new FakeProducer();
 tracingProducer = KafkaTracing.create(tracing).producer(producer);
 tracingB3SingleProducer =
   KafkaTracing.newBuilder(tracing).writeB3SingleFormat(true).build().producer(producer);
}

代码示例来源:origin: openzipkin/brave

public TracedCorrelated() {
  super(Tracing.newBuilder()
    .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder()
      // intentionally added twice to test overhead of multiple correlations
      .addScopeDecorator(ThreadContextScopeDecorator.create())
      .addScopeDecorator(ThreadContextScopeDecorator.create())
      .build())
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: stagemonitor/stagemonitor

@Override
public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) {
  final Tracing braveTracer = Tracing.newBuilder()
      .localServiceName(initArguments.getMeasurementSession().getApplicationName())
      .reporter(getZipkinReporterBuilder(initArguments).build())
      .sampler(getSampler())
      .build();
  return BraveTracer.newBuilder(braveTracer)
      .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING)
      .build();
}

代码示例来源:origin: line/armeria

@Test
public void shouldNotSubmitSpanWhenNotSampled() throws Exception {
  final SpanCollectingReporter reporter = new SpanCollectingReporter();
  final Tracing tracing = Tracing.newBuilder()
                  .localServiceName(TEST_SERVICE)
                  .spanReporter(reporter)
                  .sampler(Sampler.create(0.0f))
                  .build();
  testRemoteInvocation(tracing, null);
  assertThat(reporter.spans().poll(1, TimeUnit.SECONDS)).isNull();
}

代码示例来源:origin: line/armeria

private static Tracing newTracing(String name) {
  final CurrentTraceContext currentTraceContext =
      RequestContextCurrentTraceContext.newBuilder()
                       .addScopeDecorator(StrictScopeDecorator.create())
                       .build();
  return Tracing.newBuilder()
         .currentTraceContext(currentTraceContext)
         .localServiceName(name)
         .spanReporter(spanReporter)
         .sampler(Sampler.ALWAYS_SAMPLE)
         .build();
}

相关文章