catch and log throwables to support kotlin exception handling
MODIFY
dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/client/TracingClientInterceptor.java
dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/client/TracingClientInterceptor.java
@@ -47,7 +47,7 @@ public class TracingClientInterceptor implements ClientInterceptor {
try {
// call other interceptors
result = next.newCall(method, callOptions);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -77,7 +77,7 @@ public class TracingClientInterceptor implements ClientInterceptor {
try (final Scope ignored = tracer.scopeManager().activate(span, false)) {
super.start(new TracingClientCallListener<>(tracer, span, responseListener), headers);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -89,7 +89,7 @@ public class TracingClientInterceptor implements ClientInterceptor {
public void sendMessage(final ReqT message) {
try (final Scope ignored = tracer.scopeManager().activate(span, false)) {
super.sendMessage(message);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -122,7 +122,7 @@ public class TracingClientInterceptor implements ClientInterceptor {
.startActive(true);
try {
delegate().onMessage(message);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
final Span span = scope.span();
Tags.ERROR.set(span, true);
this.span.log(Collections.singletonMap(ERROR_OBJECT, e));
@@ -148,7 +148,7 @@ public class TracingClientInterceptor implements ClientInterceptor {
// Finishes span.
try (final Scope ignored = tracer.scopeManager().activate(span, true)) {
delegate().onClose(status, trailers);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -160,7 +160,7 @@ public class TracingClientInterceptor implements ClientInterceptor {
public void onReady() {
try (final Scope ignored = tracer.scopeManager().activate(span, false)) {
delegate().onReady();
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();

MODIFY
dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/server/TracingServerInterceptor.java
dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/server/TracingServerInterceptor.java
@@ -66,7 +66,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
try {
// call other interceptors
result = next.startCall(call, headers);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -109,7 +109,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
}
try {
delegate().onMessage(message);
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
final Span span = scope.span();
Tags.ERROR.set(span, true);
this.span.log(Collections.singletonMap(ERROR_OBJECT, e));
@@ -133,7 +133,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
if (scope instanceof TraceScope) {
((TraceScope) scope).setAsyncPropagation(false);
}
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -153,7 +153,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
if (scope instanceof TraceScope) {
((TraceScope) scope).setAsyncPropagation(false);
}
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -172,7 +172,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
if (scope instanceof TraceScope) {
((TraceScope) scope).setAsyncPropagation(false);
}
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();
@@ -190,7 +190,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
if (scope instanceof TraceScope) {
((TraceScope) scope).setAsyncPropagation(false);
}
- } catch (final RuntimeException | Error e) {
+ } catch (final Throwable e) {
Tags.ERROR.set(span, true);
span.log(Collections.singletonMap(ERROR_OBJECT, e));
span.finish();

catch and log throwables to support kotlin exception handling