Skip to content

Commit 5c983f2

Browse files
committed
add _save_aggregate wrapper with calling logic
1 parent 788299c commit 5c983f2

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

src/sentry/event_manager.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,8 @@ def save_error_events(
518518

519519
try:
520520
with sentry_sdk.start_span(op="event_manager.save.save_aggregate_fn"):
521-
group_info = _save_aggregate(
522-
event=job["event"],
523-
job=job,
524-
release=job["release"],
525-
received_timestamp=job["received_timestamp"],
526-
metric_tags=metric_tags,
521+
group_info = assign_event_to_group(
522+
event=job["event"], job=job, metric_tags=metric_tags
527523
)
528524
job["groups"] = [group_info]
529525
except HashDiscarded as err:
@@ -1337,6 +1333,33 @@ def get_culprit(data: Mapping[str, Any]) -> str:
13371333
)
13381334

13391335

1336+
def assign_event_to_group(event: Event, job: Job, metric_tags: MutableTags) -> Optional[GroupInfo]:
1337+
project = event.project
1338+
1339+
primary_grouping_config = project.get_option("sentry:grouping_config")
1340+
secondary_grouping_config = project.get_option("sentry:secondary_grouping_config")
1341+
has_mobile_config = "mobile:2021-02-12" in [primary_grouping_config, secondary_grouping_config]
1342+
1343+
if (
1344+
features.has(
1345+
"organizations:grouping-suppress-unnecessary-secondary-hash",
1346+
project.organization,
1347+
)
1348+
and not has_mobile_config
1349+
):
1350+
group_info = None # placeholder for the updated logic
1351+
else:
1352+
group_info = _save_aggregate(
1353+
event=event,
1354+
job=job,
1355+
release=job["release"],
1356+
received_timestamp=job["received_timestamp"],
1357+
metric_tags=metric_tags,
1358+
)
1359+
1360+
return group_info
1361+
1362+
13401363
def _save_aggregate(
13411364
event: Event,
13421365
job: Job,

0 commit comments

Comments
 (0)