-
-
Notifications
You must be signed in to change notification settings - Fork 458
Avoid forking rootScopes
for Reactor if current thread has NoOpScopes
#4793
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
base: main
Are you sure you want to change the base?
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Avoid forking `rootScopes` for Reactor if current thread has NoOpScopes ([#4793](https://github.com/getsentry/sentry-java/pull/4793)) If none of the above apply, you can opt out of this check by adding |
} | ||
|
||
@ApiStatus.Internal | ||
public static boolean hasScopes() { |
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.
An alternative to exposing this could be to have an overload of Sentry.getCurrentScopes()
that could e.g. have a bool parameter to specify whether to fork rootScopes
or just return NoOpScopes
if there's nothing there yet.
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.
Hmm yeah I would prefer this option, however for the purpose of the release I'm fine to go with this for now
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
806307f | 357.85 ms | 424.64 ms | 66.79 ms |
d217708 | 375.27 ms | 415.68 ms | 40.41 ms |
ee747ae | 374.71 ms | 455.18 ms | 80.47 ms |
7314dbe | 437.83 ms | 505.64 ms | 67.81 ms |
3d205d0 | 352.15 ms | 432.53 ms | 80.38 ms |
ee747ae | 358.21 ms | 389.41 ms | 31.20 ms |
d217708 | 355.34 ms | 381.39 ms | 26.05 ms |
b3d8889 | 371.33 ms | 426.24 ms | 54.92 ms |
d217708 | 409.83 ms | 474.72 ms | 64.89 ms |
b750b96 | 421.25 ms | 444.09 ms | 22.84 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
806307f | 1.58 MiB | 2.10 MiB | 533.42 KiB |
d217708 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
7314dbe | 1.58 MiB | 2.10 MiB | 533.45 KiB |
3d205d0 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
d217708 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
b3d8889 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
d217708 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
b750b96 | 1.58 MiB | 2.10 MiB | 533.20 KiB |
} | ||
|
||
@ApiStatus.Internal | ||
public static boolean hasScopes() { |
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.
Hmm yeah I would prefer this option, however for the purpose of the release I'm fine to go with this for now
📜 Description
Avoid forking
rootScopes
for Reactor if current thread has NoOpScopes.SentryReactorThreadLocalAccessor.getValue()
invokesSentry.getCurrentScopes()
which will forkrootScopes
if there is no instance ofIScopes
available (null
orNoOpScopes
).We now check for existence of
IScopes
before invokinggetCurrentScopes()
in order to avoid the unnecessary overhead.💡 Motivation and Context
Potential fix for #4762
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps