Skip to content
Draft

old #101214

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/sentry/grouping/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ def _get_variants_from_strategies(
variants[variant_name] = ComponentVariant(
root_component=root_component,
contributing_component=contributing_component,
strategy_config=context.config,
)

return variants
Expand Down
18 changes: 15 additions & 3 deletions src/sentry/grouping/grouping_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,33 @@

def get_grouping_info(
grouping_config: StrategyConfiguration, project: Project, event: Event | GroupEvent
) -> dict[str, dict[str, Any]]:
) -> dict[str, str | dict[str, Any]]:
# We always fetch the stored hashes here. The reason for this is
# that we want to show in the UI if the forced grouping algorithm
# produced hashes that would normally also appear in the event.
hashes = event.get_hashes()

variants = event.get_grouping_variants(grouping_config, normalize_stacktraces=True)

grouping_info = get_grouping_info_from_variants(variants, use_legacy_format=False)
grouping_variants = get_grouping_info_from_variants(variants, use_legacy_format=False)

# One place we use this info is in the grouping info section of the event details page, and for
# that we recalculate hashes/variants on the fly since we don't store the variants as part of
# event data. If the grouping config has been changed since the event was ingested, we may get
# different hashes here than the ones stored on the event.
_check_for_mismatched_hashes(event, project, grouping_info, hashes)
_check_for_mismatched_hashes(event, project, grouping_variants, hashes)

grouping_info_config = {
"base": grouping_config.base.id if grouping_config.base else None,
"delegates": list(grouping_config.delegates.keys()),
"id": grouping_config.id,
"strategies": list(grouping_config.strategies.keys()),
}

grouping_info = {
"grouping_config": grouping_info_config,
"variants": grouping_variants,
}

return grouping_info

Expand Down
9 changes: 2 additions & 7 deletions src/sentry/grouping/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

if TYPE_CHECKING:
from sentry.grouping.api import FingerprintInfo
from sentry.grouping.strategies.base import StrategyConfiguration


class FingerprintVariantMetadata(TypedDict):
Expand Down Expand Up @@ -119,10 +118,8 @@ def __init__(
# method (exception, threads, message, etc.). For non-contributing variants, this will be
# None.
contributing_component: ContributingComponent | None,
strategy_config: StrategyConfiguration,
):
self.root_component = root_component
self.config = strategy_config
self.contributing_component = contributing_component
self.variant_name = self.root_component.id # "app", "system", or "default"

Expand Down Expand Up @@ -154,7 +151,7 @@ def get_hash(self) -> str | None:
return self.root_component.get_hash()

def _get_metadata_as_dict(self) -> Mapping[str, Any]:
return {"component": self.root_component.as_dict(), "config": self.config.as_dict()}
return {"component": self.root_component.as_dict()}

def __repr__(self) -> str:
return super().__repr__() + f" contributes={self.contributes} ({self.description})"
Expand Down Expand Up @@ -225,7 +222,6 @@ def from_component_variant(
fingerprint=fingerprint,
root_component=component_variant.root_component,
contributing_component=component_variant.contributing_component,
strategy_config=component_variant.config,
fingerprint_info=fingerprint_info,
)

Expand All @@ -238,10 +234,9 @@ def __init__(
# method (exception, threads, message, etc.). For non-contributing variants, this will be
# None.
contributing_component: ContributingComponent | None,
strategy_config: StrategyConfiguration,
fingerprint_info: FingerprintInfo,
):
super().__init__(root_component, contributing_component, strategy_config)
super().__init__(root_component, contributing_component)
self.values = fingerprint
self.fingerprint_info = fingerprint_info

Expand Down
Loading