Skip to content

feat(native): Add option to limit crash reports per group - #15798

Merged
jan-auer merged 5 commits into
masterfrom
feat/native-limit-crashreports
Nov 26, 2019
Merged

jan-auer merged 5 commits into
masterfrom
feat/native-limit-crashreports

Conversation

@jan-auer

@jan-auer jan-auer commented Nov 25, 2019 •

Copy link
Copy Markdown
Member

Adds a feature to limit crash reports per issue group.

This extends the existing sentry:store_crash_reports option to introduce a per-issue limit. The old option only toggled storage of crash reports on or off, the new one allows to set a limit. The new setting has three states:

  • 0 disables storage of crash reports
  • -1 enables unbounded storage of crash reports
  • any positive number sets the limit.
  • (for backwards compatibility, the old True value is now shimmed to -1)

To avoid database queries in every store request, we cache the number of crash reports per issue group once we've reached the limit. This also works with group merging and unmerging. Note that we do not prune the cache keys, since merging and unmerging does not invalidate the cache invariant.

This is inherently racy between our store workers. Therefore, the count is just a best-effort to limit the number overall, but might lead to slightly more crash reports than what's configured. The obvious exception is 0, where crash reports are not stored at all.

New Settings UI

image

The old setting is applied automatically.

Migration

To run the count query efficiently, this requires group_id to be set on event attachments. Unfortunately, this was not done in the past, which is why there is a migration in #15801.

@jan-auer
jan-auer requested a review from tonyo November 25, 2019 12:46
@jan-auer jan-auer self-assigned this Nov 25, 2019
@jan-auer

jan-auer commented Nov 25, 2019 •

Copy link
Copy Markdown
Member Author

The migration is still missing. I'll add it momentarily.
Edit: Migration in a follow-up PR.

@jan-auer
jan-auer force-pushed the feat/native-limit-crashreports branch from ad8c410 to 3c80aa9 Compare November 25, 2019 14:41
Comment thread src/sentry/tasks/store.py Resolved
Comment thread src/sentry/tasks/store.py Resolved
@jan-auer
jan-auer requested a review from JTCunning November 25, 2019 16:18
@jan-auer

Copy link
Copy Markdown
Member Author

Adding @JTCunning for the Event attachment query. Note that we cache the limit once a group has exceeded it. So we only run this for the first events of each group.

https://github.com/getsentry/sentry/pull/15798/files#diff-56a31c3653d159cb70168fe95ec5958fR436-R438

@jan-auer

Copy link
Copy Markdown
Member Author

Offline review: Change to django cache.

@tonyo tonyo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As discussed internally, let's use memcached here.

@jan-auer
jan-auer requested a review from tonyo November 25, 2019 18:42
@jan-auer

Copy link
Copy Markdown
Member Author

@tonyo updated to Django cache.

@jan-auer
jan-auer merged commit a57b833 into master Nov 26, 2019
@jan-auer
jan-auer deleted the feat/native-limit-crashreports branch November 26, 2019 12:33
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants