Skip to content

Conversation

@markushi
Copy link
Member

@markushi markushi commented Nov 6, 2025

Summary

Adds log flushing functionality that triggers when the Android app transitions to the background.

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>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 04d209c

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 318.98 ms 405.18 ms 86.20 ms
Size 1.58 MiB 2.12 MiB 551.96 KiB

Baseline results on branch: main

Startup times

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);
Copy link
Member Author

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

@stefanosiano
Copy link
Member

Isn't log processor flushing every 5 seconds anyway?
Is there a new requirement for this?
Or am i misunderstanding something?

@markushi
Copy link
Member Author

markushi commented Nov 6, 2025

Isn't log processor flushing every 5 seconds anyway? Is there a new requirement for this? Or am i misunderstanding something?

The spec mentions this:

  1. When the application moves to the background, the BatchProcessor SHOULD send all data in memory and stop the timer. This is mostly relevant for mobile SDKs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants