Skip to content

fix(data_export): Cap export row limit at 10k for all callers#116048

Merged
manessaraj merged 3 commits into
masterfrom
sarajmanes/fix/export_limit_capped_at_10k
May 26, 2026
Merged

fix(data_export): Cap export row limit at 10k for all callers#116048
manessaraj merged 3 commits into
masterfrom
sarajmanes/fix/export_limit_capped_at_10k

Conversation

@manessaraj
Copy link
Copy Markdown
Contributor

@manessaraj manessaraj commented May 21, 2026

Apply a hard 10k row cap in DataExportEndpoint._parse_limit so every request that is not from UI, is bounded regardless of dataset. Requests with no limit or with limit > 10k are clamped to 10k.

Larger exports were both unreliable in practice ("broken and hammers infrastructure") and unnecessary as a self-serve path: GDPR data-portability requests are handled out-of-band via sentry.io/contact/gdpr/.

Callout:

  1. This change silently clamps the limit to 10k and doesn't raise 400 error.

Apply a hard 10k row cap in DataExportEndpoint._parse_limit so every
request: UI, API tokens, agents;  is bounded regardless of dataset.
Requests with no limit or with limit > 10k are clamped to 10k.

Larger exports were both unreliable in practice ("broken and hammers
infrastructure") and unnecessary as a self-serve path: GDPR
data-portability requests are handled out-of-band via
sentry.io/contact/gdpr/.
@manessaraj manessaraj requested a review from a team as a code owner May 21, 2026 20:03
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 21, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 7852453. Configure here.

Comment thread src/sentry/data_export/endpoints/data_export.py
Comment thread src/sentry/data_export/endpoints/data_export.py
Copy link
Copy Markdown
Member

@wmak wmak left a comment

Choose a reason for hiding this comment

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

Can you add a test for this, and maybe a docstring somewhere explaining why

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

Just confirming: we'll want a frontend change to remove the 50k and >=50k "all" option from the modal, right?

(that's straightforward to do, and I can tackle in a separate PR quickly if that's right).

@manessaraj manessaraj requested a review from a team as a code owner May 22, 2026 16:11
@manessaraj manessaraj removed the request for review from a team May 22, 2026 16:22
Comment thread src/sentry/data_export/endpoints/data_export.py
@manessaraj manessaraj merged commit 63d95ff into master May 26, 2026
62 checks passed
@manessaraj manessaraj deleted the sarajmanes/fix/export_limit_capped_at_10k branch May 26, 2026 13:46
@manessaraj
Copy link
Copy Markdown
Contributor Author

Just confirming: we'll want a frontend change to remove the 50k and >=50k "all" option from the modal, right?

(that's straightforward to do, and I can tackle in a separate PR quickly if that's right).

Yes, if "all" means full logs export; that is clamped to 10k.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants