feat(client): Add 100 MB per-batch body size limit#417
Merged
Conversation
Cap the total pre-compression body size per batch request at 100 MB in addition to the existing 1000-operation count limit. Previously, up to 1000 × 1 MB = 1 GB could be sent in a single request. Introduces `iter_batches`, a lazy iterator that splits classified operations into batches respecting both limits, replacing the `unfold`- based chunking in `send()`. The operation size is threaded through `Classified::Batchable` and `partition()` to avoid redundant stat calls. Co-Authored-By: Claude <noreply@anthropic.com>
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
🤖 This preview updates automatically when you update the PR. |
matt-codecov
approved these changes
Apr 1, 2026
Contributor
matt-codecov
left a comment
There was a problem hiding this comment.
how was this limit chosen? just somewhere to start?
Member
Author
exactly. there is a 200MB limit on the endpoint which we must not exceed, and it is close to the limit that sentry-cli uses for similar kinds of batched uploads. In some some follow-up, we can make this configurable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cap the total pre-compression body size per batch request at 100 MB, in addition to the existing 1000-operation count limit. Previously, up to 1000 × 1 MB = 1 GB could be sent in a single request.
The operation body size is threaded through
Classified::Batchableandpartition()— avoiding any redundant stat calls since classification already computes it. Batching logic is replaced withiter_batches, a lazyfrom_fniterator over aPeekablethat closes a batch whenever the next op would exceed either limit.See also https://github.com/getsentry/ops/pull/19909
Ref FS-315