-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
feat: logcat integration #2620
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. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
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.
breadcrumb.setLevel(level); | ||
breadcrumb.setData("tag", tag); | ||
if (tr != null) { | ||
breadcrumb.setData("throwable", tr.getMessage()); |
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.
I think in the first version it's fine to just have the throwable message inside the breadcrumb, @romtsn what do you think?
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.
yeah, I think that's fine
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
sentry-android-core/src/main/java/io/sentry/android/core/SentryLogcatAdapter.java
Outdated
Show resolved
Hide resolved
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.
LGTM!
import kotlin.test.assertEquals | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class SentryLogcatAdapterTest { |
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.
Nice!
📜 Description
Implements a
SentryLogcatAdapter
that will replaceLog
calls 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
sendDefaultPII
is enabled.🔮 Next steps