| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
📲 Install BuildsAndroid
|
Sorry, something went wrong.
Performance metrics 🚀
Baseline results on branch: mainStartup times
App size
|
Sorry, something went wrong.
…VA-653) The log and metrics batch processors each created their own SentryExecutorService, so an app using both spawned two threads for work that is identical in shape (a 5s flush loop that hands envelopes to the transport). SentryClient now owns a single executor, created only when logs or metrics are enabled, and injects it into both processors via the default factories. The restart shutdown path tolerates the shared executor already being closed by the sibling processor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
📜 Description
LoggerBatchProcessor and MetricsBatchProcessor each constructed their own SentryExecutorService, so an app with both logs and metrics enabled ran two dedicated threads for structurally identical work (a 5-second flush loop that batches events and hands them to the transport).
SentryClient now owns a single SentryExecutorService, created only when logs or metrics are enabled, and exposes it via getBatchProcessorExecutorService(). The default factories inject it into both processors (through the existing 3-arg LoggerBatchProcessor constructor and a new matching one on MetricsBatchProcessor). The pluggable factory interfaces are unchanged.
The shutdown paths already close the executor from each processor's close(); since the executor is now shared, the second close is a safe no-op, and the restart branch's submit(...) is guarded with the same RejectedExecutionException fallback already used in Scopes.close() for the main executor.
💡 Motivation and Context
Part of reducing the number of threads created by the SDK: JAVA-653.
Saves one thread for every app that has both logs and metrics enabled. The executor is created only when at least one of logs or metrics is enabled, and its worker thread is spawned only when the first flush is scheduled.
Note for reviewers
Custom ILoggerBatchProcessorFactory / IMetricsBatchProcessorFactory implementations that call the public 2-arg processor constructors still get an independent executor (unchanged behavior). Only the default factories opt into the shared one.
💚 How did you test it?
New SentryClientTest case asserting both processors receive the same executor instance (and that it is the client's shared one), plus the existing LoggerBatchProcessorTest, MetricsBatchProcessorTest, SentryClientTest, LoggerApiTest, and MetricsApiTest suites.
📝 Checklist
🔮 Next steps
Related PRs in this effort: RateLimiter (#5814), LifecycleWatcher (#5819), performance collector (#5816), HostnameCache (#5817).
🤖 Generated with Claude Code