Skip to content

Set thread information on transaction from OpenTelemetry attributes #4478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lcian
Copy link
Member

@lcian lcian commented Jun 6, 2025

📜 Description

If present, grabs the thread attributes from the OTEL span to populate transaction.data.thread.id and transaction.data.thread.name.

💡 Motivation and Context

Closes #4336

💚 How did you test it?

Manual testing.

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

Copy link
Contributor

github-actions bot commented Jun 6, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 517.27 ms 592.90 ms 75.63 ms
Size 1.58 MiB 2.08 MiB 511.32 KiB

Previous results on branch: lcian/fix/otel-transaction-thread

Startup times

Revision Plain With Sentry Diff
e0c26ac 438.68 ms 440.96 ms 2.28 ms
dd449bf 415.08 ms 463.96 ms 48.88 ms

App size

Revision Plain With Sentry Diff
e0c26ac 1.58 MiB 2.08 MiB 511.11 KiB
dd449bf 1.58 MiB 2.08 MiB 511.12 KiB

@lcian lcian marked this pull request as ready for review June 10, 2025 14:09
Copy link
Member

@adinauer adinauer left a comment

Choose a reason for hiding this comment

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

LGTM

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);
Copy link
Member

Choose a reason for hiding this comment

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

l for the future should we have some helper method to simply transfer an OTel attribute to Sentry since this uses the same key anyways.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I think it makes sense, I'll refactor

Co-authored-by: Alexander Dinauer <[email protected]>
@lcian lcian changed the title Set thread information on transaction from OTEL attributes Set thread information on transaction from OpenTelemetry attributes Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction has wrong thread information sent to Sentry for OpenTelemetry spans
3 participants