Zipkin:Zipkin2.Reporter.AsynCreporter $ boundedasyncreporter由于sockettimeoutexception而掉落了1个跨度(连接时间)
小Zipkin问题,请如何设定时间?
我正在编写一个非常简单的代码,其中我是 client ,然后将请求发送到服务器。
import brave.Span;
import brave.Tracing;
import zipkin2.reporter.AsyncReporter;
import zipkin2.reporter.okhttp3.OkHttpSender;
public class QuestionApplication {
public static void main(String[] args) {
var sender = OkHttpSender.newBuilder().endpoint("http://zipkin-server:9411/api/v2/spans").build();
var reporter = AsyncReporter.builder(sender).build();
var tracing = Tracing.newBuilder().localServiceName("component-test").spanReporter(reporter).build();
// Create parent span and his child --------------------
// Parent
tracing.tracer().startScopedSpan("parentSpan");
Span span = tracing.tracer().currentSpan();
span.tag("key", "firstBiz");
// Child
tracing.tracer().startScopedSpanWithParent("childSpan", tracing.tracer().currentSpan().context());
Span childSpan = tracing.tracer().currentSpan();
childSpan.tag("key", "secondBiz");
childSpan.finish();
System.out.println("id:" + childSpan.context().traceIdString());
final var response = webClient.post().uri("http://the-server.com/api/route").header("X-B3-TraceId", childSpan.context().traceIdString()).body(BodyInserters.fromValue(jsonPayload)).retrieve().bodyToMono(String.class).block();
System.out.println(response);
// Finish span
span.finish();
}
}
可重现的100%,我总是会遇到此错误:
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter flush
WARNING: Spans were dropped due to exceptions. All subsequent errors will be logged at FINE level.
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter flush
WARNING: Dropped 1 spans due to SocketTimeoutException(connect timed out)
java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:609)
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:263)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
at okhttp3.RealCall.execute(RealCall.java:81)
at zipkin2.reporter.okhttp3.HttpCall.execute(HttpCall.java:34)
at zipkin2.reporter.okhttp3.HttpCall.execute(HttpCall.java:25)
at zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:299)
at zipkin2.reporter.AsyncReporter$Flusher.run(AsyncReporter.java:378)
at java.base/java.lang.Thread.run(Thread.java:834)
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter close
WARNING: Timed out waiting for in-flight spans to send
我尝试查看内部API来设置时间,但没有运气。
请问请问有什么适当的设定时间?
谢谢
Small Zipkin question, how to set the time out please?
I am writing a very simple piece of code, where I am the client, and sending requests to a server.
import brave.Span;
import brave.Tracing;
import zipkin2.reporter.AsyncReporter;
import zipkin2.reporter.okhttp3.OkHttpSender;
public class QuestionApplication {
public static void main(String[] args) {
var sender = OkHttpSender.newBuilder().endpoint("http://zipkin-server:9411/api/v2/spans").build();
var reporter = AsyncReporter.builder(sender).build();
var tracing = Tracing.newBuilder().localServiceName("component-test").spanReporter(reporter).build();
// Create parent span and his child --------------------
// Parent
tracing.tracer().startScopedSpan("parentSpan");
Span span = tracing.tracer().currentSpan();
span.tag("key", "firstBiz");
// Child
tracing.tracer().startScopedSpanWithParent("childSpan", tracing.tracer().currentSpan().context());
Span childSpan = tracing.tracer().currentSpan();
childSpan.tag("key", "secondBiz");
childSpan.finish();
System.out.println("id:" + childSpan.context().traceIdString());
final var response = webClient.post().uri("http://the-server.com/api/route").header("X-B3-TraceId", childSpan.context().traceIdString()).body(BodyInserters.fromValue(jsonPayload)).retrieve().bodyToMono(String.class).block();
System.out.println(response);
// Finish span
span.finish();
}
}
Reproducible 100%, I am always getting this error:
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter flush
WARNING: Spans were dropped due to exceptions. All subsequent errors will be logged at FINE level.
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter flush
WARNING: Dropped 1 spans due to SocketTimeoutException(connect timed out)
java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:609)
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:263)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
at okhttp3.RealCall.execute(RealCall.java:81)
at zipkin2.reporter.okhttp3.HttpCall.execute(HttpCall.java:34)
at zipkin2.reporter.okhttp3.HttpCall.execute(HttpCall.java:25)
at zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:299)
at zipkin2.reporter.AsyncReporter$Flusher.run(AsyncReporter.java:378)
at java.base/java.lang.Thread.run(Thread.java:834)
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter close
WARNING: Timed out waiting for in-flight spans to send
I tried looking at the internal API for a method to set the time out, but no luck.
May I ask what is the proper way to set the time out please?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论