Skip to content

Commit fab8ad0

Browse files
committed
add should_use_new_assignment_logic helper
1 parent 7f100f5 commit fab8ad0

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/sentry/event_manager.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
find_existing_grouphash_new,
5555
get_hash_values,
5656
record_new_group_metrics,
57+
should_use_new_assignment_logic,
5758
update_grouping_config_if_needed,
5859
)
5960
from sentry.ingest.inbound_filters import FilterStatKeys
@@ -1362,20 +1363,8 @@ def get_culprit(data: Mapping[str, Any]) -> str:
13621363

13631364

13641365
def assign_event_to_group(event: Event, job: Job, metric_tags: MutableTags) -> GroupInfo | None:
1365-
project = event.project
1366-
1367-
primary_grouping_config = project.get_option("sentry:grouping_config")
1368-
secondary_grouping_config = project.get_option("sentry:secondary_grouping_config")
1369-
has_mobile_config = "mobile:2021-02-12" in [primary_grouping_config, secondary_grouping_config]
1370-
13711366
# TODO Once this feature is GA-ed, all of the logic from `_save_aggregate_new` can just be pulled into this shim
1372-
if (
1373-
features.has(
1374-
"organizations:grouping-suppress-unnecessary-secondary-hash",
1375-
project.organization,
1376-
)
1377-
and not has_mobile_config
1378-
):
1367+
if should_use_new_assignment_logic(event.project):
13791368
group_info = _save_aggregate_new(
13801369
event=event,
13811370
job=job,

src/sentry/grouping/ingest.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from django.conf import settings
1212
from django.core.cache import cache
1313

14-
from sentry import options
14+
from sentry import features, options
1515
from sentry.exceptions import HashDiscarded
1616
from sentry.grouping.api import (
1717
BackgroundGroupingConfigLoader,
@@ -229,6 +229,20 @@ def _calculate_primary_hash(
229229
return _calculate_event_grouping(project, job["event"], grouping_config)
230230

231231

232+
def should_use_new_assignment_logic(project: Project) -> bool:
233+
primary_grouping_config = project.get_option("sentry:grouping_config")
234+
secondary_grouping_config = project.get_option("sentry:secondary_grouping_config")
235+
has_mobile_config = "mobile:2021-02-12" in [primary_grouping_config, secondary_grouping_config]
236+
237+
return (
238+
features.has(
239+
"organizations:grouping-suppress-unnecessary-secondary-hash",
240+
project.organization,
241+
)
242+
and not has_mobile_config
243+
)
244+
245+
232246
def find_existing_grouphash_legacy(
233247
project: Project,
234248
flat_grouphashes: Sequence[GroupHash],

0 commit comments

Comments
 (0)