Skip to content

ref(grouping): Increase config transition and move config tests#112508

Merged
lobsterkatie merged 2 commits intomasterfrom
kmclb-increase-config-transition-to-90-days
Apr 8, 2026
Merged

ref(grouping): Increase config transition and move config tests#112508
lobsterkatie merged 2 commits intomasterfrom
kmclb-increase-config-transition-to-90-days

Conversation

@lobsterkatie
Copy link
Copy Markdown
Member

When a project's grouping config is updated, we put the project in a transition period, during which we calculate the old hash if we don't find the new hash, so we can attach the new hash to the old hash's group (assuming the old hash exists). This prevents grouping configs from creating new groups even though event data hasn't changed.

It used to be that during the transition period, we always calculated the old hash in addition to the new hash, even if we'd already linked the new hash to an existing group (if any). Since the vast majority of events come in to existing groups, this meant a ton of wasted calculation, and an unacceptable slow-down during ingest if too many projects were in transition at once. To limit the number of projects transitioning at any one time, we set the transition period to only last a week.

Now, however, we limit the double calculation to the first time we see an event from a given group, rather than every time we see an event from that group. Because this theoretically reduced (by multiple orders of magnitude) the extra work a transition would entail, once we made that change, we increased the transition period to a month. We still hadn't seen it in action, though.

That changed a few months ago, when we introduced a new grouping config. Sure enough, though there was an initial spike of double calculations (at about 7% of events), it dropped extremely quickly, and within a few hours it was down under 1% of events (and has only continued to fall since). Even more encouragingly, there was no noticeable change to average ingest time.

Now that we have that assurance, we can increase the transition period to the full 90 days it takes for groups to age out, thus preventing even the few groups which go more than a month between events from being recreated. This PR does just that, by changing the SENTRY_GROUPING_CONFIG_TRANSITION_DURATION constant. While we're dealing with grouping config stuff, it also moves the relevant tests to their own file, continuing the effort to have test_event_manager_grouping.py not be literally a thousand lines long.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 8, 2026
@lobsterkatie lobsterkatie force-pushed the kmclb-increase-config-transition-to-90-days branch from 45edc0d to 2c492a1 Compare April 8, 2026 19:53
@lobsterkatie lobsterkatie changed the title ref(grouping): Increase config transition and move tests ref(grouping): Increase config transition and move config tests Apr 8, 2026
@lobsterkatie lobsterkatie marked this pull request as ready for review April 8, 2026 20:11
@lobsterkatie lobsterkatie requested review from a team as code owners April 8, 2026 20:11
Copy link
Copy Markdown
Member

@shashjar shashjar left a comment

Choose a reason for hiding this comment

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

very nice, thanks for the thorough explanation in the PR desc

@lobsterkatie lobsterkatie merged commit 82814b2 into master Apr 8, 2026
77 checks passed
@lobsterkatie lobsterkatie deleted the kmclb-increase-config-transition-to-90-days branch April 8, 2026 20:20
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
)

When a project's grouping config is updated, we put the project in a transition period, during which we calculate the old hash if we don't find the new hash, so we can attach the new hash to the old hash's group (assuming the old hash exists). This prevents grouping configs from creating new groups even though event data hasn't changed.

It used to be that during the transition period, we _always_ calculated the old hash in addition to the new hash, even if we'd already linked the new hash to an existing group (if any). Since the vast majority of events come in to existing groups, this meant a ton of wasted calculation, and an unacceptable slow-down during ingest if too many projects were in transition at once. To limit the number of projects transitioning at any one time, we set the transition period to only last a week.

Now, however, we limit the double calculation to the first time we see an event from a given group, rather than every time we see an event from that group. Because this theoretically reduced (by multiple orders of magnitude) the extra work a transition would entail, once we made that change, we increased the transition period to a month. We still hadn't seen it in action, though.

That changed a few months ago, when we introduced a new grouping config. Sure enough, though there was an initial spike of double calculations (at about 7% of events), it dropped extremely quickly, and within a few hours it was down under 1% of events (and has only continued to fall since). Even more encouragingly, there was no noticeable change to average ingest time.

Now that we have that assurance, we can increase the transition period to the full 90 days it takes for groups to age out, thus preventing even the few groups which go more than a month between events from being recreated. This PR does just that, by changing the `SENTRY_GROUPING_CONFIG_TRANSITION_DURATION` constant. While we're dealing with grouping config stuff, it also moves the relevant tests to their own file, continuing the effort to have `test_event_manager_grouping.py` not be literally a thousand lines long.
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.

2 participants