-
-
Notifications
You must be signed in to change notification settings - Fork 461
feat(android): Add log flushing on app backgrounding #4873
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
Add flushLogs() method to ISentryClient interface and implement it in SentryClient to allow log processors to flush any buffered logs when the app transitions to the background. This is integrated into the lifecycle watcher and can be enabled via an opt-in SentryOptions flag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.java
Outdated
Show resolved
Hide resolved
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d217708 | 375.27 ms | 415.68 ms | 40.41 ms |
| fcec2f2 | 314.96 ms | 373.66 ms | 58.70 ms |
| ee747ae | 405.43 ms | 485.70 ms | 80.28 ms |
| bdbe1f4 | 380.66 ms | 464.44 ms | 83.78 ms |
| b750b96 | 421.25 ms | 444.09 ms | 22.84 ms |
| 674d437 | 355.28 ms | 504.18 ms | 148.90 ms |
| ee747ae | 415.92 ms | 470.15 ms | 54.23 ms |
| 3d205d0 | 352.15 ms | 432.53 ms | 80.38 ms |
| 27d7cf8 | 306.76 ms | 366.66 ms | 59.90 ms |
| b3d8889 | 420.46 ms | 453.71 ms | 33.26 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d217708 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.50 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| bdbe1f4 | 1.58 MiB | 2.11 MiB | 538.88 KiB |
| b750b96 | 1.58 MiB | 2.10 MiB | 533.20 KiB |
| 674d437 | 1.58 MiB | 2.10 MiB | 530.94 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 3d205d0 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| 27d7cf8 | 1.58 MiB | 2.12 MiB | 549.42 KiB |
| b3d8889 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
| */ | ||
| void flush(long timeoutMillis); | ||
|
|
||
| void flushLogs(long timeoutMillis); |
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.
Not the biggest fan of adding a new API here, an alternative would be to move this directly into ILoggerApi
|
Isn't log processor flushing every 5 seconds anyway? |
The spec mentions this:
|
Summary
Adds log flushing functionality that triggers when the Android app transitions to the background.