Skip to content

Commit f17ceaf

Browse files
authored
ref(grouping): Remove unused code (#97518)
This removes a few bits of unused grouping code: - The last use of the grouping component class's `shallow_copy` method was removed in #96379. - The `StrategyConfiguration` constructor doesn't use its `**extras` argument, and nothing that calls it passes any unexpected parameters. - The only use of the `PerformanceProblemVariant` class was removed in #97016.
1 parent 9951db7 commit f17ceaf

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

src/sentry/grouping/component.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import Counter
55
from collections.abc import Generator, Iterator, Sequence
66
from functools import cached_property
7-
from typing import Any, Self
7+
from typing import Any
88

99
from sentry.grouping.utils import hash_from_values
1010

@@ -149,13 +149,6 @@ def update(
149149
if contributes is not None:
150150
self.contributes = contributes
151151

152-
def shallow_copy(self) -> Self:
153-
"""Creates a shallow copy."""
154-
copy = object.__new__(self.__class__)
155-
copy.__dict__.update(self.__dict__)
156-
copy.values = list(self.values)
157-
return copy
158-
159152
def iter_values(self) -> Generator[str | int]:
160153
"""
161154
Recursively walks the component tree, gathering literal values from contributing

src/sentry/grouping/strategies/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class StrategyConfiguration:
322322
enhancements_base: str | None = DEFAULT_ENHANCEMENTS_BASE
323323
fingerprinting_bases: Sequence[str] | None = DEFAULT_GROUPING_FINGERPRINTING_BASES
324324

325-
def __init__(self, enhancements: str | None = None, **extra: Any):
325+
def __init__(self, enhancements: str | None = None):
326326
if enhancements is None:
327327
enhancements_instance = Enhancements.from_rules_text("", referrer="strategy_config")
328328
else:

src/sentry/grouping/variants.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,34 +96,6 @@ def get_hash(self) -> str | None:
9696
return hash_from_values([])
9797

9898

99-
class PerformanceProblemVariant(BaseVariant):
100-
"""
101-
Applies only to transaction events! Transactions are not subject to the
102-
normal grouping pipeline. Instead, they are fingerprinted by
103-
`PerformanceDetector` when the event is saved by `EventManager`. We detect
104-
problems, generate some metadata called "evidence" and use that evidence
105-
for fingerprinting. The evidence is then stored in `nodestore`. This
106-
variant's hash is delegated to the `EventPerformanceProblem` that
107-
contains the event and the evidence.
108-
"""
109-
110-
type = "performance_problem"
111-
description = "performance problem"
112-
113-
def __init__(self, event_performance_problem: Any):
114-
self.event_performance_problem = event_performance_problem
115-
self.problem = event_performance_problem.problem
116-
117-
def get_hash(self) -> str | None:
118-
return self.problem.fingerprint
119-
120-
def _get_metadata_as_dict(self) -> Mapping[str, Any]:
121-
problem_data = self.problem.to_dict()
122-
evidence_hashes = self.event_performance_problem.evidence_hashes
123-
124-
return {"evidence": {**problem_data, **evidence_hashes}}
125-
126-
12799
class ComponentVariant(BaseVariant):
128100
"""A variant that produces a hash from the `BaseGroupingComponent` it encloses."""
129101

0 commit comments

Comments
 (0)