feat: logcat integration#2620
Conversation
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d81684e | 235.73 ms | 328.76 ms | 93.03 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d81684e | 1.73 MiB | 2.26 MiB | 547.78 KiB |
Previous results on branch: feat/logcat-integration
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6dbe27a | 277.26 ms | 294.76 ms | 17.50 ms |
| 8a1a524 | 366.12 ms | 388.69 ms | 22.57 ms |
| 8feb38e | 311.12 ms | 376.45 ms | 65.32 ms |
| 3372342 | 345.15 ms | 379.94 ms | 34.79 ms |
| 174b08b | 363.30 ms | 403.38 ms | 40.08 ms |
| 3abf17c | 448.04 ms | 479.16 ms | 31.12 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6dbe27a | 1.73 MiB | 2.26 MiB | 548.10 KiB |
| 8a1a524 | 1.73 MiB | 2.26 MiB | 547.78 KiB |
| 8feb38e | 1.73 MiB | 2.26 MiB | 547.63 KiB |
| 3372342 | 1.73 MiB | 2.26 MiB | 548.10 KiB |
| 174b08b | 1.73 MiB | 2.26 MiB | 548.04 KiB |
| 3abf17c | 1.73 MiB | 2.26 MiB | 547.63 KiB |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #2620 +/- ##
=========================================
Coverage 81.34% 81.34%
Complexity 4211 4211
=========================================
Files 337 337
Lines 15575 15575
Branches 2034 2034
=========================================
Hits 12670 12670
Misses 2110 2110
Partials 795 795 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
markushi
left a comment
There was a problem hiding this comment.
Looking good, please check my comments
| @NotNull String tag, @NotNull SentryLevel level, String msg, Throwable tr) { | ||
| Breadcrumb breadcrumb = new Breadcrumb(); |
There was a problem hiding this comment.
We usually like to use the final keyword to indicate that objects will not be re-assigned.
| @NotNull String tag, @NotNull SentryLevel level, String msg, Throwable tr) { | |
| Breadcrumb breadcrumb = new Breadcrumb(); | |
| @NotNull final String tag, @NotNull final SentryLevel level, final String msg, final Throwable tr) { | |
| final Breadcrumb breadcrumb = new Breadcrumb(); |
| Sentry.addBreadcrumb(breadcrumb); | ||
| } | ||
|
|
||
| public static int v(String tag, @NotNull String msg) { |
| breadcrumb.setLevel(level); | ||
| breadcrumb.setData("tag", tag); | ||
| if (tr != null) { | ||
| breadcrumb.setData("throwable", tr.getMessage()); |
There was a problem hiding this comment.
I think in the first version it's fine to just have the throwable message inside the breadcrumb, @romtsn what do you think?
|
I think it could make sense to add an integration test here as well.
|
| * io.sentry.Breadcrumb} for each log. It only replaces log functions that meet a minimum level set | ||
| * by the user on the Sentry Android Gradle Plugin. | ||
| */ | ||
| @ApiStatus.Internal |
There was a problem hiding this comment.
Dunno if it makes sense to make it public, people might want to still use it instead of android.util.Log, but without the gradle plugin, what do you think @markushi @buenaflor ?
There was a problem hiding this comment.
IMHO I wouldn't 😅 Since the config for minLogLevel lives within the gradle plugin, people calling the SentryLogcatAdapter will always generate breadcrumbs, even for e.g. verbose logging
| import kotlin.test.assertEquals | ||
|
|
||
| @RunWith(AndroidJUnit4::class) | ||
| class SentryLogcatAdapterTest { |

📜 Description
Implements a
SentryLogcatAdapterthat will replaceLogcalls via bytecode manipulation in the Sentry AGP.💡 Motivation and Context
Ref: #1620
This adapter is needed by the AGP. See: getsentry/sentry-android-gradle-plugin#455
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps