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

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

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

Tracing.current介绍

[英]Returns the most recently created tracing component iff it hasn't been closed. null otherwise.

This object should not be cached.
[中]如果尚未关闭,则返回最近创建的跟踪组件。否则为空。
不应缓存此对象。

代码示例

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

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

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

/**
 * This closes the current instance of tracing, to prevent it from being accidentally visible to
 * other test classes which call {@link Tracing#current()}.
 */
@After public void close() throws Exception {
 Tracing current = Tracing.current();
 if (current != null) current.close();
}

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

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

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

@TearDown(Level.Trial) public void close() throws Exception {
 if (server != null) server.stop();
 client.dispatcher().executorService().shutdown();
 if (Tracing.current() != null) Tracing.current().close();
}

代码示例来源:origin: io.zipkin.brave/brave

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

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

@TearDown(Level.Trial) public void close() {
 Tracing.current().close();
}

代码示例来源:origin: io.zipkin.brave/brave-propagation-aws

/** Returns the current {@link #traceId(TraceContext)} or null if not available */
@Nullable public static String currentTraceId() {
 Tracing tracing = Tracing.current();
 if (tracing == null) return null;
 TraceContext context = tracing.currentTraceContext().get();
 if (context == null) return null;
 return traceId(context);
}

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

@TearDown(Level.Trial) public void close() {
 Tracing.current().close();
}

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

@TearDown(Level.Trial) public void close() {
 Tracing.current().close();
}

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

@TearDown(Level.Trial) public void close() {
 Tracing.current().close();
}

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

@After
public void tearDown() {
  Tracing.current().close();
}

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

@After
public void tearDown() {
  Tracing.current().close();
}

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

@After
public void tearDown() {
  Tracing.current().close();
}

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

@TearDown(Level.Trial) public void close() throws Exception {
 close(client);
 close(unsampledClient);
 close(tracedClient);
 server.stop();
 Tracing.current().close();
}

代码示例来源:origin: io.zipkin.brave/brave-instrumentation-http-tests

/**
 * This closes the current instance of tracing, to prevent it from being accidentally visible to
 * other test classes which call {@link Tracing#current()}.
 */
@After public void close() throws Exception {
 Tracing current = Tracing.current();
 if (current != null) current.close();
}

相关文章