zipkin2.reporter.AsyncReporter.flush()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(184)

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

AsyncReporter.flush介绍

[英]Calling this will flush any pending spans to the transport on the current thread.

Note: If you set Builder#messageTimeout(long,TimeUnit) to zero, you must call this externally as otherwise spans will never be sent.
[中]调用此函数将刷新当前线程上传输的所有挂起跨距。
注意:如果将Builder#messageTimeout(long,TimeUnit)设置为零,则必须在外部调用此函数,否则将永远不会发送跨度。

代码示例

代码示例来源:origin: alipay/sofa-tracer

@Override
public void flush() {
  this.delegate.flush();
}

代码示例来源:origin: com.alipay.sofa/tracer-sofa-boot-starter

@Override
public void flush() throws IOException {
  this.delegate.flush();
}

代码示例来源:origin: com.alipay.sofa/sofa-tracer-zipkin-plugin

@Override
public void flush() {
  this.delegate.flush();
}

代码示例来源:origin: openzipkin/zipkin-finagle

@Test public void unfinishedSpansArentImplicitlyReported() throws Exception {
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new ServiceName("web"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new Rpc("get"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), ClientSend$.MODULE$, empty()));
 tracer.reporter.flush();
 assertThat(spansSent.take()).isEmpty();
}

代码示例来源:origin: openzipkin/zipkin-finagle

@Test public void finishedSpansAreImplicitlyReported() throws Exception {
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new ServiceName("web"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new Rpc("get"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), ClientSend$.MODULE$, empty()));
 // client receive reports the span
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY + 1), ClientRecv$.MODULE$, empty()));
 tracer.reporter.flush();
 assertThat(spansSent.take().stream())
   .flatExtracting(Span::kind)
   .containsExactly(Span.Kind.CLIENT);
}

代码示例来源:origin: openzipkin/zipkin-finagle

/** See {@link traceId128Bit$} */
@Test public void traceId128Bit() throws Exception {
  TraceId root = TraceId$.MODULE$.apply(
   SpanId.fromString("0f28590523a46541"),
   empty(),
   SpanId.fromString("0f28590523a46541").get(),
   empty(),
   Flags$.MODULE$.apply(),
   SpanId.fromString("d2f9288a2904503d"),
   false
 );
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new ServiceName("web"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new Rpc("get"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), ClientSend$.MODULE$, empty()));
 // client receive reports the span
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY + 1), ClientRecv$.MODULE$, empty()));
 tracer.reporter.flush();
 assertThat(spansSent.take().stream())
   .extracting(Span::traceId)
   .containsExactly("d2f9288a2904503d0f28590523a46541");
}

代码示例来源:origin: openzipkin/zipkin-finagle

tracer.reporter.flush();
 failBecauseExceptionWasNotThrown(IllegalStateException.class);
} catch (IllegalStateException e) {

代码示例来源:origin: openzipkin/zipkin-finagle

@Test
public void reportIncrementsAcceptedMetrics() throws Exception {
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new ServiceName("web"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), new Rpc("get"), empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY), ClientSend$.MODULE$, empty()));
 tracer.record(new Record(root, Time.fromMilliseconds(TODAY + 1), ClientRecv$.MODULE$, empty()));
 tracer.reporter.flush();
 assertThat(mapAsJavaMap(stats.counters())).containsExactly(
   entry(seq("span_bytes"), 165L),
   entry(seq("spans"), 1L),
   entry(seq("spans_dropped"),0L),
   entry(seq("message_bytes"), 170L),
   entry(seq("messages"), 1L)
 );
}

相关文章