Skip to content

feat(client): Add 100 MB per-batch body size limit#417

Merged
jan-auer merged 2 commits intomainfrom
feat/batch-body-size-limit
Apr 2, 2026
Merged

feat(client): Add 100 MB per-batch body size limit#417
jan-auer merged 2 commits intomainfrom
feat/batch-body-size-limit

Conversation

@jan-auer
Copy link
Copy Markdown
Member

@jan-auer jan-auer commented Apr 1, 2026

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::Batchable and partition() — avoiding any redundant stat calls since classification already computes it. Batching logic is replaced with iter_batches, a lazy from_fn iterator over a Peekable that closes a batch whenever the next op would exceed either limit.

See also https://github.com/getsentry/ops/pull/19909
Ref FS-315

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>
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 1, 2026

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (client) Add 100 MB per-batch body size limit by jan-auer in #417

🤖 This preview updates automatically when you update the PR.

@jan-auer jan-auer marked this pull request as ready for review April 1, 2026 09:55
@jan-auer jan-auer requested a review from a team as a code owner April 1, 2026 09:55
Copy link
Copy Markdown
Contributor

@matt-codecov matt-codecov left a comment

Choose a reason for hiding this comment

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

how was this limit chosen? just somewhere to start?

@jan-auer
Copy link
Copy Markdown
Member Author

jan-auer commented Apr 2, 2026

how was this limit chosen? just somewhere to start?

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.

@jan-auer jan-auer enabled auto-merge (squash) April 2, 2026 07:06
@jan-auer jan-auer merged commit 2e75c50 into main Apr 2, 2026
22 checks passed
@jan-auer jan-auer deleted the feat/batch-body-size-limit branch April 2, 2026 07:08
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