Preserve original exception in jetty http client wrappers (#7455)
Same issue as in https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/7452
This commit is contained in:
parent
d38bc4d2a4
commit
e683fd9bee
|
@ -9,6 +9,7 @@ import static java.util.stream.Collectors.toList;
|
|||
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.context.Scope;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -71,6 +72,8 @@ public final class JettyClientWrapUtil {
|
|||
(proxy, method, args) -> {
|
||||
try (Scope ignored = context.makeCurrent()) {
|
||||
return method.invoke(listener, args);
|
||||
} catch (InvocationTargetException exception) {
|
||||
throw exception.getCause();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.opentelemetry.context.Context;
|
|||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -118,6 +119,8 @@ public class JettyHttpClient9TracingInterceptor
|
|||
(proxy, method, args) -> {
|
||||
try (Scope ignored = context.makeCurrent()) {
|
||||
return method.invoke(listener, args);
|
||||
} catch (InvocationTargetException exception) {
|
||||
throw exception.getCause();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue