[WIP] perf: serialize telemetry batches on shared thread pool - #1883
[WIP] perf: serialize telemetry batches on shared thread pool#1883jpnurmi wants to merge 3 commits into
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- serialize telemetry batches on shared thread pool ([#1883](https://github.com/getsentry/sentry-native/pull/1883))If none of the above apply, you can opt out of this check by adding |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## jpnurmi/ref/sentry-telemetry #1883 +/- ##
================================================================
+ Coverage 69.80% 76.04% +6.23%
================================================================
Files 94 94
Lines 22133 22545 +412
Branches 3930 4018 +88
================================================================
+ Hits 15451 17144 +1693
+ Misses 4719 4515 -204
+ Partials 1963 886 -1077 🚀 New features to boost your workflow:
|
2996a56 to
ec39dc8
Compare
ec39dc8 to
829189b
Compare
829189b to
406b054
Compare
406b054 to
03159d6
Compare
e417bed to
12f4872
Compare
33f0d1a to
d39154d
Compare
d39154d to
9dee343
Compare
265b68d to
8c2f921
Compare
8e78e16 to
e92e866
Compare
Add a bounded thread pool that runs tasks in parallel and invokes completion callbacks in submission order. Add unit coverage for ordered parallel execution.
Let the telemetry lifecycle own a shared serialization pool for enabled telemetry batchers. Use the pool for log and metric batch serialization while keeping completion ordered through the batcher flush lifecycle.
e92e866 to
9793aaf
Compare
Make sentry__threadpool_submit consume task data consistently by calling the cleanup callback when submission fails. This matches the existing task ownership model and keeps callers from having to duplicate cleanup on rejection.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ba24ac6. Configure here.
| || sentry__atomic_fetch(&task->state) | ||
| == SENTRY_BATCH_TASK_RUNNING; | ||
| } | ||
| unlock_tasks(batcher); |
There was a problem hiding this comment.
Spinlock held across heavy dump work
Medium Severity
batch_task_dump_pending runs batch_func and sentry__run_write_envelope while dump_pending_all still holds task_lock. Pool workers use a plain sentry__spin_lock to publish READY, so they busy-spin for the whole serialization and disk write. That stretches crash-flush latency and makes the RUNNING-wait timeout much easier to hit.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ba24ac6. Configure here.


Warning
WIP 🚧🔨⏳⛔
before-vs-after.ftrace.zip
Close: #1862