Skip to content
Draft
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 @@ -53,25 +53,26 @@ public SentryProducerInterceptor(final @NotNull IScopes scopes) {
return record;
}

final @NotNull SpanOptions spanOptions = new SpanOptions();
spanOptions.setOrigin(TRACE_ORIGIN);
final @NotNull ISpan span = activeSpan.startChild("queue.publish", record.topic(), spanOptions);
if (span.isNoOp()) {
return record;
}
try {
final @NotNull SpanOptions spanOptions = new SpanOptions();
spanOptions.setOrigin(TRACE_ORIGIN);
final @NotNull ISpan span =
activeSpan.startChild("queue.publish", record.topic(), spanOptions);
if (span.isNoOp()) {
return record;
}

span.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka");
span.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic());
span.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka");
span.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic());

try {
injectHeaders(record.headers(), span);

span.setStatus(SpanStatus.OK);
span.finish();
} catch (Throwable ignored) {
// Header injection must not break the send
// Instrumentation must never break the customer's Kafka send
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the original, should we log anything here?

}

span.setStatus(SpanStatus.OK);
span.finish();

return record;
}

Expand Down
Loading