-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update scopes documentation for Java and Android #4747
Conversation
@designedbyz is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
I stumbled across the Local Scopes documentation while looking for information on the Kotlin extensions and thought I could make it a bit more clear. I also made mentioning that exceptions and errors thrown within `with-scope` an alert as I found that to be very surprising and unexpected, particularly as that seems like different behavior from `configure-scope`.
Not using a `SentryContext` when working with Sentry in a coroutine _may_ have been the cause of a bug I dealt with at work recently. Since lots of Android apps use Kotlin now, the Sentry Kotlin Extensions should be called out in the setup guides.
bdb056f
to
44654b2
Compare
Local scopes are not supported on Android, but the documentation for them still shows up anyways. Conversely, information about the Kotlin extensions is missing, but many Android apps make heavy use of Kotlin and Coroutines, so this section should be displayed.
The android specific scope synchronization block was right after the code block that demonstrated setting a user, and before the code block that unsets a user. This made reading the documentation confusing, so I extracted a new included page and added a new platform section that only supports android to hold it.
44654b2
to
85df56d
Compare
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/sentry/sentry-docs/EkCz5J51j1LRy6CoCsHut9y875am |
Hello! I just wanted to bump this and see if there's anything you need from me to get this merged. Happy to make changes as needed! |
Hi @designedbyz, not yet. Once technical review is completed on this, we'll review it for writing/style and then there might be some feedback. Sorry about the delay. |
@designedbyz, since there are a few concerns raised from technical review, I'll wait till those are resolved before I review for writing/style. |
Not a problem! I just wanted to check in. Thanks for getting eyes on this! |
Hey @marandaneto, @bruno-garcia, any chance of an updated review? |
src/platforms/common/enriching-events/attachments/index.mdx Please fix the linking error, so I can check the preview and its changes, thanks :) |
Yay, looks like the license check passed and Vercel deployed the most recent changes! |
Thanks, I will review on Monday :) |
Awesome, thank you! |
|
||
<PlatformSection supported={["java"]} notSupported={["android"]}> | ||
<PlatformSection supported={["java", "android"]}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need to keep android as non supported due to https://github.com/getsentry/sentry-docs/pull/4747/files#r841714836
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! with this did you mean that you wanted to remove the mention of Kotlin as well as the local scopes stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for Android, since there's a global hub/scope, it does not make sense to use that integration, so we can remove from the android page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, that makes sense. As a counter point though, I was confused that it was mentioned for Java and not Android, which is why I added it to begin with. What do you think about mentioning somewhere in the Android setup docs that the Kotlin extensions aren't needed for Android?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, the content is not for Android at all, it even says:
Sentry's SDK for Java stores the scope and the context in a thread-local variable
Instead of Sentry's SDK for Android, which is the case for all the other Android integrations, I guess explaining something from another platform would also make confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marandaneto done in 10b558e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, the content is not for Android at all, it even says:
Sentry's SDK for Java stores the scope and the context in a thread-local variable
Instead of Sentry's SDK for Android, which is the case for all the other Android integrations, I guess explaining something from another platform would also make confusion.
To go back to this thread though, I was confused and thought that the Kotlin extensions lib was needed for two reasons:
- The first is the general tendency for java focused libs to have a
lib-ktx
library with extension functions focused on making the library more kotlin-like in the Kotlin world. - The platforms page for Kotlin explicitly says that it can be used for Android, and mentions the Kotlin Extensions, and links to the Java page There's nothing in either the Kotlin page or the using Sentry with coroutines part of the Java documents that says the extension functions library isn't needed for Android.
Thus, it's really easy for someone who's not familiar with the platform but using Kotlin on Android to poke around the docs and accidentally think that they need the Kotlin extensions library, when they do not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, The goal is that sentry-kotlin-extensions
get expanded and add extension functions to be "Kotlin friendly", but right now it only has the SentryContext
and this only makes sense for non-Android.
E.g. https://github.com/getsentry/sentry-java/pull/1886/files
This would make sense for Android too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave this specific part for another PR, this will get addressed automatically when we land the 1st Kotlin function in the sentry-kotlin-extensions
library for Android, which is gonna be very soon :)
Thanks for the feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, The goal is that sentry-kotlin-extensions get expanded and add extension functions to be "Kotlin friendly", but right now it only has the SentryContext and this only makes sense for non-Android.
Got it, that makes sense.
E.g. https://github.com/getsentry/sentry-java/pull/1886/files
This would make sense for Android too.
Oooh, that would be handy.
I'd leave this specific part for another PR, this will get addressed automatically when we land the 1st Kotlin function in the sentry-kotlin-extensions library for Android, which is gonna be very soon :)
Thanks for the feedback.
Awesome! That sounds good to me!
@imatwawana it's ready for wording review, the only issue left is #4747 (comment) from the technical point of view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some wording, style, and punctuation edits, but otherwise, looks great!
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
83e8bc6
to
e2de2e3
Compare
Also, sorry for those force pushes earlier, I was trying to update this branch with |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thanks @designedbyz and sorry for the back and forth. |
@marandaneto You're welcome, don't worry about it, I'm responsible for a bunch of it 😅 Thank you for reviewing! |
I was looking for information on the Sentry Kotlin extensions recently and as they're only significantly used for scopes found my way there. I found the documentation was a bit confusing, and decided to improve it. I also hid local scopes for Android since the documentation said that they are not supported there, and displayed the Kotlin Extensions information, as many Android apps use Kotlin and Coroutines (like the one I work on that uses Sentry!!). Finally, I moved the scope synchronization information out of the middle of the demonstration of setting and unsetting a user with
with-config
I realize that the contributing docs say not to touch the common content, but that was very much needed, both to improve clarity and clean up the Android documentation.