Repository navigation
feat: Add per-metric windows to lock free metrics batcher - #8327
alexander-alderman-webb wants to merge 51 commits into
Conversation
Coverage Results 📊✅ 59761 passed | ⏭️ 3119 skipped | Total: 62880 | Pass Rate: 95.04% | Execution Time: 164m 47s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 89.31% (117 of 131 changed executable lines covered; target 80%). Changed files with executable lines (3)
Coverage diff@@ Coverage Diff @@
## master #8327 +/-##
==========================================
- Coverage 90.11% 90.10% -0.01%
==========================================
Files 201 202 +1
Tracked lines 22199 22461 +262
Branches 7784 7866 +82
==========================================
+ Hits 20004 20238 +234
- Misses 2195 2223 +28
- Partials 1283 1300 +17Generated by Coverage Action |
…window-metrics-batcher-2
…window-metrics-batcher-2 # Conflicts: # tests/test_metrics.py
…window-metrics-batcher-2
…window-metrics-batcher-2
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3b40b5b. Configure here.
…window-metrics-batcher-2
…ding-window-metrics-batcher-2
…ding-window-metrics-batcher-2
…window-metrics-batcher-2
PR risk: mediumFor commit Main concerns: data sent to Sentry, public contract, host performance. Rules that block low also fired:
This label is a hint for reviewers, not an approval. |

Description
Keeps window-sampled metrics in a thread-local reservoir, and performs uniform sampling once the window is no longer the active window. Segmenting metrics per thread while the window is being modified enables lock-free operations (only a thread touches its state).
Conceptually, each window has thread state, and each thread state has a reservoir of metrics.
There can be multiple consumers if
sentry_sdk.flush()runs concurrently with the background flusher. This is expected and handled byIndexError.Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)