Skip to content
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

Replace Android thread id with kernel thread id in span data #3706

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

stefanosiano
Copy link
Member

📜 Description

renamed IMainThreadChecker to IThreadChecker
added getCurrentThreadSystemId() to IThreadChecker
replaced thread id of SentryTracer and PerformanceAndroidEventProcessor

Adding to v8, since it's a behavioural change and users could already use it in some dashboard, as it's indexed. This is very unlikely, though.

💡 Motivation and Context

Continuous profiler needs to bind the trace and span to the corresponding thread in the profile.
The Android profiler retrieves the kernel thread id, that we can get via Process.myTid(), so we have to set that instead of Thread.getThreadId()

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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.

🔮 Next steps

added getCurrentThreadId() to IThreadChecker
replaced thread id of SentryTracer and PerformanceAndroidEventProcessor
@stefanosiano
Copy link
Member Author

Most changes come from renaming IMainThreadChecker to IThreadChecker.
I can revert the renaming if you like it more

@stefanosiano stefanosiano marked this pull request as ready for review September 20, 2024 14:46
Copy link
Contributor

github-actions bot commented Sep 20, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 437.31 ms 452.81 ms 15.50 ms
Size 1.70 MiB 2.35 MiB 667.30 KiB

Previous results on branch: enh/android-kernel-thread-id

Startup times

Revision Plain With Sentry Diff
e312dff 436.72 ms 491.35 ms 54.63 ms

App size

Revision Plain With Sentry Diff
e312dff 1.70 MiB 2.35 MiB 667.25 KiB

Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple of comments around mainThreadId

@stefanosiano stefanosiano merged commit 61a31d5 into 8.x.x Sep 23, 2024
13 of 22 checks passed
@stefanosiano stefanosiano deleted the enh/android-kernel-thread-id branch September 23, 2024 13:33
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.

2 participants