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

Hubs/Scopes Merge 38 - Use ScopeType.COMBINED for cross platform (InternalSentrySdk) #3375

Merged
merged 44 commits into from
May 2, 2024

Conversation

adinauer
Copy link
Member

#skip-changelog

📜 Description

To send values from all scope types (global, isolation, current) to cross platform SDKs we use ScopeType.COMBINED for .configureScope to retrieve all tags, breadcrumbs etc.

💡 Motivation and Context

💚 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

adinauer and others added 30 commits March 27, 2024 16:30
Copy link
Contributor

github-actions bot commented Apr 19, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 130f966

@@ -44,9 +45,9 @@ public final class InternalSentrySdk {
@Nullable
public static IScope getCurrentScope() {
final @NotNull AtomicReference<IScope> scopeRef = new AtomicReference<>();
// TODO [HSM] should this retrieve combined scope?
Copy link
Member Author

@adinauer adinauer Apr 19, 2024

Choose a reason for hiding this comment

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

Yes, at least until cross-platform SDKs support separate scope types themselves.

@@ -431,8 +433,7 @@ public void setPropagationContext(@NotNull PropagationContext propagationContext

@Override
public @NotNull IScope clone() {
// TODO [HSM] just return a new CombinedScopeView with forked scope?
return getDefaultWriteScope().clone();
return new CombinedScopeView(globalScope, isolationScope.clone(), scope.clone());
Copy link
Member Author

Choose a reason for hiding this comment

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

The idea here is to have a clone that doesn't change the original so we're safer by cloning both isolation and current scope.

@@ -454,7 +455,6 @@ public void bindClient(@NotNull ISentryClient client) {

@Override
public @NotNull ISentryClient getClient() {
// TODO [HSM] checking for noop here doesn't allow disabling via client, is that ok?
Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed internally with backend team, if a customer needs this, they can provide their own noop ISentryClient that isn't actually NoOpSentryClient and thus not detected here.

@@ -4,7 +4,5 @@ public enum ScopeType {
CURRENT,
ISOLATION,
GLOBAL,

// TODO [HSM] do we need a combined as well so configureScope
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, at least for cross platform SDKs until they support different scope types separately themselves.

@@ -646,9 +646,7 @@ public void withScope(final @NotNull ScopeCallback callback) {

} else {
final @NotNull IScopes forkedScopes = forkedCurrentScope("withScope");
// TODO [HSM] should forkedScopes be made current inside callback?
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'd expect Sentry.setTag to operate on the forked scopes inside withScope

Copy link
Contributor

github-actions bot commented Apr 19, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 379.04 ms 431.88 ms 52.83 ms
Size 1.70 MiB 2.28 MiB 595.24 KiB

Previous results on branch: feat/hsm-38-combined-scope-for-cross-platform

Startup times

Revision Plain With Sentry Diff
d429cf3 405.68 ms 497.78 ms 92.09 ms

App size

Revision Plain With Sentry Diff
d429cf3 1.70 MiB 2.28 MiB 595.24 KiB

@@ -138,14 +139,17 @@ class InternalSentrySdkTest {
)
// TODO [HSM] add breadcrumbs to all scopes and assert they are there
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this comment still relevant?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, already removed.

Base automatically changed from feat/hsm-37-combined-contexts to 8.x.x May 2, 2024 12:25
@adinauer adinauer merged commit 9349303 into 8.x.x May 2, 2024
10 of 17 checks passed
@adinauer adinauer deleted the feat/hsm-38-combined-scope-for-cross-platform branch May 2, 2024 12:26
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.

None yet

3 participants