Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.sentry.ISentryLifecycleToken;
import io.sentry.ITransaction;
import io.sentry.ScopesAdapter;
import io.sentry.SentryLevel;
import io.sentry.SentryTraceHeader;
import io.sentry.SpanDataConvention;
import io.sentry.SpanStatus;
Expand Down Expand Up @@ -83,7 +84,11 @@ <K, V, U> U withTracingImpl(
try {
forkedScopes = scopes.forkedRootScopes(CREATOR);
lifecycleToken = forkedScopes.makeCurrent();
} catch (Throwable ignored) {
} catch (Throwable t) {
scopes
.getOptions()
.getLogger()
.log(SentryLevel.ERROR, "Failed to fork scopes for Kafka consumer tracing.", t);
return callable.call();
}

Expand Down Expand Up @@ -175,7 +180,11 @@ private boolean isIgnored() {
}

return transaction;
} catch (Throwable ignored) {
} catch (Throwable t) {
scopes
.getOptions()
.getLogger()
.log(SentryLevel.ERROR, "Failed to start Kafka consumer tracing transaction.", t);
return null;
}
}
Expand All @@ -194,8 +203,12 @@ private void finishTransaction(
transaction.setThrowable(throwable);
}
transaction.finish();
} catch (Throwable ignored) {
} catch (Throwable t) {
// Instrumentation must never break customer processing.
scopes
.getOptions()
.getLogger()
.log(SentryLevel.ERROR, "Failed to finish Kafka consumer tracing transaction.", t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.sentry.IScopes;
import io.sentry.ISpan;
import io.sentry.ScopesAdapter;
import io.sentry.SentryLevel;
import io.sentry.SentryTraceHeader;
import io.sentry.SpanDataConvention;
import io.sentry.SpanOptions;
Expand Down Expand Up @@ -71,8 +72,11 @@ public SentryKafkaProducerInterceptor(

span.setStatus(SpanStatus.OK);
span.finish();
} catch (Throwable ignored) {
// Instrumentation must never break the customer's Kafka send.
} catch (Throwable t) {
scopes
.getOptions()
.getLogger()
.log(SentryLevel.ERROR, "Failed to instrument Kafka producer record.", t);
}

return record;
Expand Down
Loading