opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Opentelemetry throws error if a span takes more than 10 seconds

Open Krishnankk opened this issue 1 year ago • 2 comments

I was showing traces from my java application using opentelemetry in jaeger UI. Everything was showing successfully. But when it takes more than 10 seconds for an API call for a span, then it shows following error.

Service Version
Jaeger v2.3.0
Opentelemetry v2.13.0
opentelemetry-api v1.47.0
opentelemetry-sdk v1.47.0
opentelemetry-exporter-jaeger v1.34.1
opentelemetry-extension-annotations v1.18.0
opentelemetry-instrumentation-annotations v2.13.1

Error:

Image

java.net.SocketTimeoutException: timeout
	at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:143)
	at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:162)
	at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:340)
	at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:449)
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:333)
	at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
	at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
	at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
	at io.opentelemetry.javaagent.shaded.instrumentation.okhttp.v3_0.internal.TracingInterceptor.intercept(TracingInterceptor.java:46)

This API may take 30 seconds because there are some polling mechanism running as per the requirement of that application. Is there any option to increase waiting time for this span in opentelemetry ?

Krishnankk avatar Mar 19 '25 10:03 Krishnankk

are you sure you are not just observing the default timeout for the okhttp client?

jaydeluca avatar Mar 19 '25 10:03 jaydeluca

are you sure you are not just observing the default timeout for the okhttp client?

Thank you for the response. As you said, it issue was not in the jaeger or opentelemetry side. Issue was in the okhttp client with default timeout. I have changed the configuration as per the document.

Now issue is fixed. thanks

Krishnankk avatar Mar 20 '25 07:03 Krishnankk