Skip to content

feat(batcher): Add hard span limit - #7143

Merged
alexander-alderman-webb merged 5 commits into
masterfrom
webb/batcher/max-spans-before-drop
Aug 10, 2026
Merged

feat(batcher): Add hard span limit#7143
alexander-alderman-webb merged 5 commits into
masterfrom
webb/batcher/max-spans-before-drop

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Add a hard span limit after which new spans are not added to the batcher. This mirrors the per-bucket logic.

This aims to keep memory use bounded at a multiple of the size of live StreamedSpan objects.

Adapt the test_drop_after_max_reached() test which tests the per-bucket span limit to a test which tests the global span limit. Also add the test_capture_after_flush_with_global_limit() to ensure accurate bookkeeping to track the number of spans in the batcher.

Issues

Reminders

Comment thread sentry_sdk/_span_batcher.py
Comment thread sentry_sdk/_span_batcher.py
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

101547 passed | ⏭️ 6635 skipped | Total: 108182 | Pass Rate: 93.87% | Execution Time: 353m 45s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +30
Passed Tests 📈 +30
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 83.33%. Project has 2498 uncovered lines.
❌ Project coverage is 90.01%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/_span_batcher.py 83.33% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    90.02%    90.01%    -0.01%
==========================================
  Files          193       193         —
  Lines        25010     25014        +4
  Branches      9032      9032         —
==========================================
+ Hits         22514     22516        +2
- Misses        2496      2498        +2
- Partials      1434      1435        +1

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review August 10, 2026 07:11
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner August 10, 2026 07:11
Comment thread sentry_sdk/_span_batcher.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit faf5684. Configure here.

Comment thread sentry_sdk/_span_batcher.py Outdated
@alexander-alderman-webb
alexander-alderman-webb merged commit 58cba75 into master Aug 10, 2026
271 of 273 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/batcher/max-spans-before-drop branch August 10, 2026 08:25
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.

2 participants