Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Session Replay: Do not capture current replay for cached events from the past ([#4474](https://github.com/getsentry/sentry-java/pull/4474))
- Session Replay: Correctly capture Dialogs and non full-sized windows ([#4354](https://github.com/getsentry/sentry-java/pull/4354))
- Session Replay: Fix inconsistent `segment_id` ([#4471](https://github.com/getsentry/sentry-java/pull/4471))
- Set thread information on transaction from OTEL attributes ([#4478](https://github.com/getsentry/sentry-java/pull/4478))
Comment thread
lcian marked this conversation as resolved.
Outdated

## 8.13.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes;
import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes;
import io.sentry.Baggage;
import io.sentry.DateUtils;
import io.sentry.DefaultSpanFactory;
Expand Down Expand Up @@ -339,6 +340,7 @@ private void transferSpanDetails(
setOtelInstrumentationInfo(span, sentryTransaction);
setOtelSpanKind(span, sentryTransaction);
transferSpanDetails(sentrySpanMaybe, sentryTransaction);
maybeTransferOtelThreadAttributes(span, sentryTransaction);

scopesToUse.configureScope(
ScopeType.CURRENT,
Expand All @@ -347,6 +349,19 @@ private void transferSpanDetails(
return sentryTransaction;
}

private void maybeTransferOtelThreadAttributes(
final @NotNull SpanData span, final @NotNull ITransaction sentryTransaction) {
final @NotNull Attributes attributes = span.getAttributes();
final @Nullable Long threadId = attributes.get(ThreadIncubatingAttributes.THREAD_ID);
Comment thread
lcian marked this conversation as resolved.
Outdated
if (threadId != null) {
sentryTransaction.setData(ThreadIncubatingAttributes.THREAD_ID.getKey(), threadId);
}
final @Nullable String threadName = attributes.get(ThreadIncubatingAttributes.THREAD_NAME);
if (threadName != null) {
sentryTransaction.setData(ThreadIncubatingAttributes.THREAD_NAME.getKey(), threadName);
}
}

private List<SpanNode> findCompletedRootNodes(final @NotNull List<SpanNode> grouped) {
final @NotNull Predicate<SpanNode> isRootPredicate =
(node) -> {
Expand Down
Loading