Skip to content

Commit

Permalink
add should_use_new_assignment_logic helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Feb 12, 2024
1 parent 7f100f5 commit fab8ad0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
15 changes: 2 additions & 13 deletions src/sentry/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
find_existing_grouphash_new,
get_hash_values,
record_new_group_metrics,
should_use_new_assignment_logic,
update_grouping_config_if_needed,
)
from sentry.ingest.inbound_filters import FilterStatKeys
Expand Down Expand Up @@ -1362,20 +1363,8 @@ def get_culprit(data: Mapping[str, Any]) -> str:


def assign_event_to_group(event: Event, job: Job, metric_tags: MutableTags) -> GroupInfo | None:
project = event.project

primary_grouping_config = project.get_option("sentry:grouping_config")
secondary_grouping_config = project.get_option("sentry:secondary_grouping_config")
has_mobile_config = "mobile:2021-02-12" in [primary_grouping_config, secondary_grouping_config]

# TODO Once this feature is GA-ed, all of the logic from `_save_aggregate_new` can just be pulled into this shim
if (
features.has(
"organizations:grouping-suppress-unnecessary-secondary-hash",
project.organization,
)
and not has_mobile_config
):
if should_use_new_assignment_logic(event.project):
group_info = _save_aggregate_new(
event=event,
job=job,
Expand Down
16 changes: 15 additions & 1 deletion src/sentry/grouping/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.conf import settings
from django.core.cache import cache

from sentry import options
from sentry import features, options
from sentry.exceptions import HashDiscarded
from sentry.grouping.api import (
BackgroundGroupingConfigLoader,
Expand Down Expand Up @@ -229,6 +229,20 @@ def _calculate_primary_hash(
return _calculate_event_grouping(project, job["event"], grouping_config)


def should_use_new_assignment_logic(project: Project) -> bool:
primary_grouping_config = project.get_option("sentry:grouping_config")
secondary_grouping_config = project.get_option("sentry:secondary_grouping_config")
has_mobile_config = "mobile:2021-02-12" in [primary_grouping_config, secondary_grouping_config]

return (
features.has(
"organizations:grouping-suppress-unnecessary-secondary-hash",
project.organization,
)
and not has_mobile_config
)


def find_existing_grouphash_legacy(
project: Project,
flat_grouphashes: Sequence[GroupHash],
Expand Down

0 comments on commit fab8ad0

Please sign in to comment.