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

chore(android): Add docs for using the Android SDK within a shared environment #11089

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

markushi
Copy link
Member

@markushi markushi commented Aug 14, 2024

Fixes #10910

DESCRIBE YOUR PR

Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@markushi markushi requested a review from kahest August 14, 2024 14:46
Copy link

vercel bot commented Aug 14, 2024

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

Name Status Preview Comments Updated (UTC)
changelog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 27, 2024 8:48am
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 27, 2024 8:48am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
develop-docs ⬜️ Ignored (Inspect) Visit Preview Aug 27, 2024 8:48am

Copy link

codecov bot commented Aug 14, 2024

Bundle Report

Changes will increase total bundle size by 210 bytes ⬆️

Bundle name Size Change
sentry-docs-server 8.24MB 219 bytes ⬆️
sentry-docs-edge-server 254.34kB 3 bytes ⬇️
sentry-docs-client 6.25MB 6 bytes ⬇️

@@ -0,0 +1,60 @@
---
title: Shared Environments
Copy link
Member

Choose a reason for hiding this comment

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

m: title should be more descriptive, also not sure if troubleshooting is the ideal parent page - maybe usage or data management? wdty?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 I've moved it to the bottom of our configuration section. Title is now "Using Sentry within an SDK"


<Note>

Using the sentry SDK within another SDK is discouraged. This can lead to unexpected behavior and potential data leakage. If you need to use Sentry within another SDK, please follow the best practices outlined below.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Using the sentry SDK within another SDK is discouraged. This can lead to unexpected behavior and potential data leakage. If you need to use Sentry within another SDK, please follow the best practices outlined below.
Using the Sentry SDK within another SDK is [discouraged](https://docs.sentry.io/platforms/). This can lead to unexpected behaviour and potential data leakage. If you need to use Sentry within another SDK, please follow the best practices outlined below.

@vivianyentran
Copy link
Contributor

Hi there, the docs team is focusing on other priorities at the moment, so it may take us another week or more to get to this PR. If you need us to review this sooner, please let us know so we can prioritize accordingly. Thanks for your patience!

</Note>

In order to not conflict with other Sentry instances, you should use the `Hub` API to create a new instance of Sentry.
The Hub API works the same way as the global Sentry instance, but it is not global and can be used within your component. If you want to capture uncaught exceptions, you can use the `UncaughtExceptionHandlerIntegration` to capture them. As this will capture all uncaught exceptions within your app, you should use the `BeforeSendCallback` to filter out events that are not relevant for your SDK.
Copy link
Member

Choose a reason for hiding this comment

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

It's implied by the text, but should we be explicit that there are no default integrations?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I wouldn't as we barely have any docs about the other integrationn, most of them are marked as internal, and many of them could leak user data.

When setting up Sentry in a shared environment where multiple Sentry instances may run, you should **not use `Sentry.init()`**, as this will pollute the global state.

</Note>

Copy link
Member

Choose a reason for hiding this comment

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

Are there any specific use cases like Browser Extensions in JS, just so readers won't confuse it with using RN and Android for example.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, but I rephrased it a bit to make it more clear - thanks!

Copy link
Member

@krystofwoldrich krystofwoldrich left a comment

Choose a reason for hiding this comment

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

Looks good, I left some thoughts in comments but nothing crucial.

@markushi markushi merged commit 094e1f3 into master Aug 27, 2024
10 checks passed
@markushi markushi deleted the chore/android-shared-env branch August 27, 2024 09:44
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2024
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.

Guide for usage in shared environments
5 participants