-
-
Notifications
You must be signed in to change notification settings - Fork 463
feat(android): Add log flushing on app backgrounding #4951
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
Merged
markushi
merged 4 commits into
main
from
markushi/feat/android-app-lifecycle-log-flushing-2
Dec 4, 2025
Merged
feat(android): Add log flushing on app backgrounding #4951
markushi
merged 4 commits into
main
from
markushi/feat/android-app-lifecycle-log-flushing-2
Dec 4, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Member
Author
|
@sentry review |
sentry-android-core/src/main/java/io/sentry/android/core/AndroidLoggerBatchProcessor.java
Show resolved
Hide resolved
sentry-android-core/src/test/java/io/sentry/android/core/AndroidLoggerBatchProcessorTest.kt
Show resolved
Hide resolved
sentry-android-core/src/test/java/io/sentry/android/core/AndroidLoggerBatchProcessorTest.kt
Show resolved
Hide resolved
Comment on lines
26
to
32
|
|
||
| public final class LoggerBatchProcessor implements ILoggerBatchProcessor { | ||
| @Open | ||
| public class LoggerBatchProcessor implements ILoggerBatchProcessor { | ||
|
|
||
| public static final int FLUSH_AFTER_MS = 5000; | ||
| public static final int MAX_BATCH_SIZE = 100; | ||
| public static final int MAX_QUEUE_SIZE = 1000; |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| abfcc92 | 337.38 ms | 427.39 ms | 90.00 ms |
| ce0a49e | 532.00 ms | 609.96 ms | 77.96 ms |
| 3998a95 | 415.94 ms | 478.54 ms | 62.60 ms |
| f634d01 | 375.06 ms | 420.04 ms | 44.98 ms |
| 674d437 | 355.28 ms | 504.18 ms | 148.90 ms |
| ee747ae | 374.71 ms | 455.18 ms | 80.47 ms |
| bbc35bb | 324.88 ms | 425.73 ms | 100.85 ms |
| 3d205d0 | 352.15 ms | 432.53 ms | 80.38 ms |
| d364ace | 411.72 ms | 430.81 ms | 19.10 ms |
| ee747ae | 382.73 ms | 435.41 ms | 52.68 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| abfcc92 | 1.58 MiB | 2.13 MiB | 557.31 KiB |
| ce0a49e | 1.58 MiB | 2.10 MiB | 532.94 KiB |
| 3998a95 | 1.58 MiB | 2.10 MiB | 532.96 KiB |
| f634d01 | 1.58 MiB | 2.10 MiB | 533.40 KiB |
| 674d437 | 1.58 MiB | 2.10 MiB | 530.94 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| bbc35bb | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| 3d205d0 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| d364ace | 1.58 MiB | 2.11 MiB | 539.75 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
Previous results on branch: markushi/feat/android-app-lifecycle-log-flushing-2
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 4fc0d17 | 345.00 ms | 364.09 ms | 19.09 ms |
| 79a3c33 | 302.67 ms | 371.61 ms | 68.94 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 4fc0d17 | 1.58 MiB | 2.13 MiB | 558.99 KiB |
| 79a3c33 | 1.58 MiB | 2.13 MiB | 559.00 KiB |
romtsn
approved these changes
Dec 4, 2025
Member
romtsn
left a comment
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.
Looks good, thanks for reworking it, looks much cleaner now! 👨🍳
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
Adds log flushing functionality that triggers when the Android app transitions to the background.
In favor of the more complicated old PR #4873
💡 Motivation and Context
Reduced data loss
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps