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

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

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

Tracing.currentTraceContext介绍

[英]This supports in-process propagation, typically across thread boundaries. This includes utilities for concurrent types like java.util.concurrent.ExecutorService.
[中]这支持进程内传播,通常跨越线程边界。这包括针对java等并发类型的实用程序。util。同时发生的执行服务。

代码示例

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

TracingProducer(P delegate, JmsTracing jmsTracing) {
 this.delegate = delegate;
 this.jmsTracing = jmsTracing;
 this.tracer = jmsTracing.tracing.tracer();
 this.current = jmsTracing.tracing.currentTraceContext();
 this.remoteServiceName = jmsTracing.remoteServiceName;
}

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

TracingMessagePostProcessor(SpringRabbitTracing springRabbitTracing) {
 this.springRabbitTracing = springRabbitTracing;
 this.tracing = springRabbitTracing.tracing;
 this.tracer = tracing.tracer();
 this.currentTraceContext = tracing.currentTraceContext();
 this.injector = springRabbitTracing.injector;
 this.remoteServiceName = springRabbitTracing.remoteServiceName;
}

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

TracingProducer(Producer<K, V> delegate, KafkaTracing kafkaTracing) {
 this.delegate = delegate;
 this.kafkaTracing = kafkaTracing;
 this.current = kafkaTracing.tracing.currentTraceContext();
 this.tracer = kafkaTracing.tracing.tracer();
 this.injector = kafkaTracing.injector;
 this.extractor = kafkaTracing.extractor;
 this.remoteServiceName = kafkaTracing.remoteServiceName;
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Around("anyControllerOrRestControllerWithPublicAsyncMethod()")
@SuppressWarnings("unchecked")
public Object wrapWithCorrelationId(ProceedingJoinPoint pjp) throws Throwable {
  Callable<Object> callable = (Callable<Object>) pjp.proceed();
  TraceContext currentSpan = this.tracing.currentTraceContext().get();
  if (currentSpan == null) {
    return callable;
  }
  if (log.isDebugEnabled()) {
    log.debug("Wrapping callable with span [" + currentSpan + "]");
  }
  return new TraceCallable<>(this.tracing, this.spanNamer, callable);
}

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

TracingCallFactory(HttpTracing httpTracing, OkHttpClient ok) {
 if (httpTracing == null) throw new NullPointerException("HttpTracing == null");
 if (ok == null) throw new NullPointerException("OkHttpClient == null");
 this.currentTraceContext = httpTracing.tracing().currentTraceContext();
 OkHttpClient.Builder builder = ok.newBuilder();
 builder.networkInterceptors().add(0, TracingInterceptor.create(httpTracing));
 this.ok = builder.build();
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

ScopePassingSpanSubscriber(Subscriber<? super T> subscriber, Context ctx,
    Tracing tracing, @Nullable Span root) {
  this.subscriber = subscriber;
  this.currentTraceContext = tracing.currentTraceContext();
  this.traceContext = root == null ? null : root.context();
  this.context = ctx != null && root != null ? ctx.put(Span.class, root)
      : ctx != null ? ctx : Context.empty();
  if (log.isTraceEnabled()) {
    log.trace("Root span [" + root + "], context [" + this.context + "]");
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
  return this.delegate
      .submitListenable(this.tracing.currentTraceContext().wrap(task));
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public ListenableFuture<?> submitListenable(Runnable task) {
  return this.delegate
      .submitListenable(this.tracing.currentTraceContext().wrap(task));
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public void execute(Runnable task, long startTimeout) {
  this.delegate.execute(this.tracing.currentTraceContext().wrap(task),
      startTimeout);
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public void execute(Runnable task) {
  this.delegate.execute(this.tracing.currentTraceContext().wrap(task));
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public <T> Future<T> submit(Callable<T> task) {
  return this.delegate.submit(this.tracing.currentTraceContext().wrap(task));
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

@Override
public Future<?> submit(Runnable task) {
  return this.delegate.submit(this.tracing.currentTraceContext().wrap(task));
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

public TraceCallable(Tracing tracing, SpanNamer spanNamer, Callable<V> delegate,
    String name) {
  this.tracer = tracing.tracer();
  this.delegate = delegate;
  this.parent = tracing.currentTraceContext().get();
  this.spanName = name != null ? name : spanNamer.name(delegate, DEFAULT_SPAN_NAME);
}

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

@Nullable static TraceContext currentTraceContext() {
 Tracing tracing = Tracing.current();
 return tracing != null ? tracing.currentTraceContext().get() : null;
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

public TraceRunnable(Tracing tracing, SpanNamer spanNamer, Runnable delegate,
    String name) {
  this.tracer = tracing.tracer();
  this.delegate = delegate;
  this.parent = tracing.currentTraceContext().get();
  this.spanName = name != null ? name : spanNamer.name(delegate, DEFAULT_SPAN_NAME);
}

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

@Benchmark public void tracedClient_get_resumeTrace() throws Exception {
  try (Scope scope = Tracing.current().currentTraceContext().newScope(context)) {
   get(tracedClient);
  }
 }
}

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

TracingHttpAsyncClientBuilder(HttpTracing httpTracing) { // intentionally hidden
 if (httpTracing == null) throw new NullPointerException("httpTracing == null");
 this.currentTraceContext = httpTracing.tracing().currentTraceContext();
 this.handler = HttpClientHandler.create(httpTracing, new HttpAdapter());
 this.injector = httpTracing.tracing().propagation().injector(SETTER);
}

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

HttpServerHandler(HttpTracing httpTracing, HttpServerAdapter<Req, Resp> adapter) {
 super(
   httpTracing.tracing().currentTraceContext(),
   adapter,
   httpTracing.serverParser()
 );
 this.tracer = httpTracing.tracing().tracer();
 this.sampler = httpTracing.serverSampler();
}

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

HttpClientHandler(HttpTracing httpTracing, HttpClientAdapter<Req, Resp> adapter) {
 super(
   httpTracing.tracing().currentTraceContext(),
   adapter,
   httpTracing.clientParser()
 );
 this.tracer = httpTracing.tracing().tracer();
 this.sampler = httpTracing.tracing().sampler();
 this.httpSampler = httpTracing.clientSampler();
 this.serverName = !"".equals(httpTracing.serverName()) ? httpTracing.serverName() : null;
}

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

TracingFilter(HttpTracing httpTracing) {
 tracer = httpTracing.tracing().tracer();
 currentTraceContext = httpTracing.tracing().currentTraceContext();
 handler = HttpServerHandler.create(httpTracing, ADAPTER);
 extractor = httpTracing.tracing().propagation().extractor(GETTER);
}

相关文章