Add SentryWrapper for Callable and Supplier Interface#2720
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Add SentryWrapper for Callable and Supplier Interface ([#2720](https://github.com/getsentry/sentry-java/pull/2720))If none of the above apply, you can opt out of this check by adding |
|
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 46b1782 | 387.72 ms | 458.74 ms | 71.02 ms |
| 1707044 | 338.80 ms | 384.79 ms | 46.00 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 46b1782 | 1.72 MiB | 2.28 MiB | 570.44 KiB |
| 1707044 | 1.72 MiB | 2.28 MiB | 570.44 KiB |
Previous results on branch: feat/wrap_callable_supplier
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 05983b3 | 348.50 ms | 391.60 ms | 43.10 ms |
| 207c2b4 | 311.66 ms | 354.66 ms | 43.00 ms |
| b934ebe | 295.77 ms | 379.27 ms | 83.50 ms |
| 998fee2 | 311.46 ms | 383.30 ms | 71.84 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 05983b3 | 1.72 MiB | 2.28 MiB | 570.44 KiB |
| 207c2b4 | 1.72 MiB | 2.28 MiB | 570.45 KiB |
| b934ebe | 1.72 MiB | 2.28 MiB | 570.44 KiB |
| 998fee2 | 1.72 MiB | 2.28 MiB | 570.44 KiB |
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
|
Should we automatically capture exceptions in there? Maybe configurable to turn on/off? |
To not block this PR, let's decide via #2729 |
| final IHub oldState = Sentry.getCurrentHub(); | ||
| final IHub newHub = Sentry.getCurrentHub().clone(); |
There was a problem hiding this comment.
Nit-picking here, but I think this could be simplified to the following. In theory it's also technically "more correct" in case some other thread is executing Sentry.setCurrentHub in between those statements.
| final IHub oldState = Sentry.getCurrentHub(); | |
| final IHub newHub = Sentry.getCurrentHub().clone(); | |
| final IHub oldHub = Sentry.getCurrentHub(); | |
| final IHub newHub = oldHub.clone(); |
There was a problem hiding this comment.
Oh I see that Sentry.currentHub is thread-local anyway for non global hub mode setups (ThreadLocal<IHub> currentHub), so my suggestion only improves if globalHubMode=true.
stefanosiano
left a comment
There was a problem hiding this comment.
just a couple of quick changes
looks good for the rest
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2720 +/- ##
=========================================
Coverage 81.11% 81.12%
- Complexity 4449 4453 +4
=========================================
Files 345 346 +1
Lines 16407 16420 +13
Branches 2226 2226
=========================================
+ Hits 13308 13320 +12
- Misses 2172 2173 +1
Partials 927 927
☔ View full report in Codecov by Sentry. |
📜 Description
Allow Injection of SentryHub into Callable and Supplier Contexts.
💡 Motivation and Context
Fixes #2426
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps