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

Update scopes documentation for Java and Android #4747

Merged
merged 19 commits into from
Apr 27, 2022

Conversation

designedbyz
Copy link
Contributor

@designedbyz designedbyz commented Feb 19, 2022

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.

@vercel
Copy link

vercel bot commented Feb 19, 2022

@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.
designedbyz and others added 2 commits February 19, 2022 01:18
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.
@vercel
Copy link

vercel bot commented Feb 22, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sentry/sentry-docs/EkCz5J51j1LRy6CoCsHut9y875am
✅ Preview: https://sentry-docs-git-fork-designedbyz-update-scopes.sentry.dev

@designedbyz
Copy link
Contributor Author

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!

@imatwawana
Copy link
Contributor

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.

@imatwawana
Copy link
Contributor

@designedbyz, since there are a few concerns raised from technical review, I'll wait till those are resolved before I review for writing/style.

@designedbyz
Copy link
Contributor Author

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.

Not a problem! I just wanted to check in. Thanks for getting eyes on this!

@designedbyz
Copy link
Contributor Author

Hey @marandaneto, @bruno-garcia, any chance of an updated review?

@marandaneto
Copy link
Contributor

Hey @marandaneto, @bruno-garcia, any chance of an updated review?

src/platforms/common/enriching-events/attachments/index.mdx
error: bad link platforms/android/enriching-events/scopes#local-scopes at line 72

Please fix the linking error, so I can check the preview and its changes, thanks :)

@designedbyz
Copy link
Contributor Author

Yay, looks like the license check passed and Vercel deployed the most recent changes!

@marandaneto
Copy link
Contributor

Yay, looks like the license check passed and Vercel deployed the most recent changes!

Thanks, I will review on Monday :)

@designedbyz
Copy link
Contributor Author

Thanks, I will review on Monday :)

Awesome, thank you!


<PlatformSection supported={["java"]} notSupported={["android"]}>
<PlatformSection supported={["java", "android"]}>
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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:

  1. 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.
  2. 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.
    image

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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!

@marandaneto
Copy link
Contributor

@imatwawana it's ready for wording review, the only issue left is #4747 (comment) from the technical point of view.

Copy link
Contributor

@imatwawana imatwawana left a 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!

src/includes/getting-started-install/android.mdx Outdated Show resolved Hide resolved
src/platforms/common/enriching-events/scopes.mdx Outdated Show resolved Hide resolved
src/platforms/common/enriching-events/scopes.mdx Outdated Show resolved Hide resolved
src/platforms/common/enriching-events/scopes.mdx Outdated Show resolved Hide resolved
src/platforms/common/enriching-events/scopes.mdx Outdated Show resolved Hide resolved
src/platforms/common/enriching-events/scopes.mdx Outdated Show resolved Hide resolved
src/platforms/common/enriching-events/scopes.mdx Outdated Show resolved Hide resolved
marandaneto and others added 7 commits April 5, 2022 10:03
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>
@designedbyz
Copy link
Contributor Author

Also, sorry for those force pushes earlier, I was trying to update this branch with master, but got things in a weird state, so I just put it all back to how it was before I started trying to rebase/ include the changes. (I'm usually in closed source land, so this is my first PR across repos 😅 )10b558e has the latest changes requested by @marandaneto

@vercel
Copy link

vercel bot commented Apr 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
sentry-docs ✅ Ready (Inspect) Visit Preview Apr 27, 2022 at 7:29AM (UTC)

@marandaneto
Copy link
Contributor

Thanks @designedbyz and sorry for the back and forth.

@designedbyz
Copy link
Contributor Author

@marandaneto You're welcome, don't worry about it, I'm responsible for a bunch of it 😅 Thank you for reviewing!

@designedbyz designedbyz deleted the update-scopes branch April 27, 2022 19:42
@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants