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 17 - Add global scope #3319

Merged
merged 22 commits into from
Apr 19, 2024
Merged

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Apr 4, 2024

#skip-changelog

📜 Description

Add global scope.

💡 Motivation and Context

Certain things should be globally accessable (default client, throwable to span map, ...).
This will also allow users to set certain things globally without worrying about Sentry.init or risking lost updates.

💚 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

Copy link
Contributor

github-actions bot commented Apr 4, 2024

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

Generated by 🚫 dangerJS against 24d6d46

@@ -47,6 +47,8 @@ private Sentry() {}

/** The Main Hub or NoOp if Sentry is disabled. */
private static volatile @NotNull IScopes mainScopes = NoOpScopes.getInstance();
// TODO cannot pass options here
private static volatile @NotNull IScope globalScope = new Scope(new SentryOptions());
Copy link
Member Author

Choose a reason for hiding this comment

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

It should be possible for users to set data on global scope even before Sentry.init. Not quite sure where we should go with implementation. Likely we'll need a Scope constructor that doesn't require options and set options later on. Not quite sure how that should affect limits (e.g. for breadcrumbs) etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Problem resolved in #3362

Copy link
Contributor

github-actions bot commented Apr 4, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 493.19 ms 592.92 ms 99.73 ms
Size 1.70 MiB 2.28 MiB 591.73 KiB

Previous results on branch: feat/hsm-17-global-scope

Startup times

Revision Plain With Sentry Diff
f245862 388.33 ms 456.90 ms 68.57 ms
92f0daa 390.07 ms 456.60 ms 66.54 ms

App size

Revision Plain With Sentry Diff
f245862 1.70 MiB 2.28 MiB 591.73 KiB
92f0daa 1.70 MiB 2.28 MiB 591.72 KiB

@adinauer adinauer changed the title Add global scope Hubs / Scopes Merge m7 - Add global scope Apr 4, 2024
@adinauer adinauer changed the title Hubs / Scopes Merge m7 - Add global scope Hubs / Scopes Merge 7 - Add global scope Apr 4, 2024
@adinauer adinauer changed the title Hubs / Scopes Merge 7 - Add global scope Hubs / Scopes Merge 17 - Add global scope Apr 4, 2024
Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

LGTM, assuming all todos will be followed up later.

Base automatically changed from feat/hsm-16-move-client-span-map to 8.x.x April 19, 2024 12:03
@adinauer
Copy link
Member Author

LGTM, assuming all todos will be followed up later.

TODOs have been resolved in #3362

@adinauer adinauer merged commit 6390bc6 into 8.x.x Apr 19, 2024
19 of 20 checks passed
@adinauer adinauer deleted the feat/hsm-17-global-scope branch April 19, 2024 12:06
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.

3 participants