Skip to content

Commit 6f8de6a

Browse files
authored
feat(grouping): Deprecate mobile grouping config (#74457)
When events come in for projects with the mobile grouping config, they will start transitioning to the latest project config. Once we can run the one-off script in GoCD, we can also transition projects without any events. This takes advantage of the feature added in #74203.
1 parent 5f7d0ee commit 6f8de6a

File tree

3 files changed

+6
-111
lines changed

3 files changed

+6
-111
lines changed

src/sentry/grouping/ingest/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
Job = MutableMapping[str, Any]
1919

2020
# We are moving all projects off these configuration without waiting for events
21-
CONFIGS_TO_DEPRECATE: list[str] = []
21+
CONFIGS_TO_DEPRECATE: list[str] = [
22+
"mobile:2021-02-12",
23+
]
2224

2325

2426
def update_grouping_config_if_needed(project: Project) -> None:

tests/sentry/event_manager/test_event_manager_grouping.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,8 @@ def test_deprecated_configs_upgrade_automatically(self):
189189
with override_settings(SENTRY_GROUPING_AUTO_UPDATE_ENABLED=True):
190190
update_grouping_config_if_needed(self.project)
191191
# Nothing changes
192-
assert self.project.get_option("sentry:grouping_config") == "mobile:2021-02-12"
193-
assert self.project.get_option("sentry:grouping_auto_update") is False
194-
195-
# XXX: In the future, once the mobile grouping is added to the list, we will remove this line
196-
with mock.patch(
197-
"sentry.grouping.ingest.config.CONFIGS_TO_DEPRECATE",
198-
new=["mobile:2021-02-12"],
199-
):
200-
update_grouping_config_if_needed(self.project)
201-
# Even though auto update is disabled we have upgraded the project
202-
assert self.project.get_option("sentry:grouping_config") == DEFAULT_GROUPING_CONFIG
203-
# We have also updated the auto_update option
204-
assert self.project.get_option("sentry:grouping_auto_update") is True
192+
assert self.project.get_option("sentry:grouping_config") == DEFAULT_GROUPING_CONFIG
193+
assert self.project.get_option("sentry:grouping_auto_update") is True
205194

206195

207196
class PlaceholderTitleTest(TestCase):

tests/sentry/event_manager/test_hierarchical_hashes.py

Lines changed: 1 addition & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55

66
import pytest
77

8-
from sentry.event_manager import EventManager, _save_aggregate
8+
from sentry.event_manager import _save_aggregate
99
from sentry.eventstore.models import Event
1010
from sentry.grouping.result import CalculatedHashes
1111
from sentry.models.group import Group
1212
from sentry.models.grouphash import GroupHash
13-
from sentry.testutils.cases import TestCase
1413
from sentry.testutils.pytest.fixtures import django_db_all
1514

1615

@@ -199,98 +198,3 @@ def test_partial_move(default_project, fast_save):
199198
assert not new_group_info.is_new
200199
assert not new_group_info.is_regression
201200
assert new_group_info.group.id == group_info.group.id
202-
203-
204-
class EventManagerGroupingTest(TestCase):
205-
def test_can_upgrade_to_hierarchical_config(self):
206-
self.set_options("legacy:2019-03-12") # Starting configuration
207-
208-
event = self.save_event()
209-
210-
self.transition_to_new_config("mobile:2021-02-12")
211-
212-
# This event will have two sets of hashes
213-
event2 = self.save_event()
214-
215-
# The hashes property between the two events do not intersect
216-
assert not set(event.get_hashes().hashes) & set(event2.get_hashes().hashes)
217-
# They are both grouped together
218-
assert event.group_id == event2.group_id
219-
220-
group = Group.objects.get(id=event.group_id)
221-
222-
assert group.times_seen == 2
223-
assert group.last_seen == event2.datetime
224-
225-
# After expiry, new events are still assigned to the same group:
226-
self.project.update_option("sentry:secondary_grouping_expiry", 0)
227-
event3 = self.save_event()
228-
assert event3.group_id == event2.group_id
229-
230-
def test_can_downgrade_from_hierarchical_config(self):
231-
self.set_options("mobile:2021-02-12") # Starting configuration
232-
233-
event = self.save_event()
234-
235-
self.transition_to_new_config("legacy:2019-03-12")
236-
237-
# This event will have two sets of hashes
238-
event2 = self.save_event()
239-
240-
# The hashes property between the two events do not intersect
241-
assert not set(event.get_hashes().hashes) & set(event2.get_hashes().hashes)
242-
# They are both grouped together
243-
assert event.group_id == event2.group_id
244-
245-
group = Group.objects.get(id=event.group_id)
246-
247-
group_hashes = GroupHash.objects.filter(
248-
project=self.project, hash__in=event.get_hashes().hashes
249-
)
250-
assert group_hashes
251-
for hash in group_hashes:
252-
assert hash.group_id == event.group_id
253-
254-
assert group.times_seen == 2
255-
assert group.last_seen == event2.datetime
256-
257-
# After expiry, new events are still assigned to the same group:
258-
self.project.update_option("sentry:secondary_grouping_expiry", 0)
259-
event3 = self.save_event()
260-
assert event3.group_id == event2.group_id
261-
262-
def save_event(self):
263-
manager = EventManager(
264-
make_event(
265-
message="foo 123",
266-
event_id=hex(2**127)[-32:],
267-
exception={
268-
"values": [
269-
{
270-
"type": "Hello",
271-
"stacktrace": {
272-
"frames": [
273-
{"function": "not_in_app_function"},
274-
{"function": "in_app_function"},
275-
]
276-
},
277-
}
278-
]
279-
},
280-
)
281-
)
282-
manager.normalize()
283-
with self.tasks():
284-
return manager.save(self.project.id)
285-
286-
def set_options(self, primary_config):
287-
self.project.update_option("sentry:grouping_config", primary_config)
288-
self.project.update_option("sentry:secondary_grouping_expiry", 0)
289-
290-
def transition_to_new_config(self, new_config):
291-
original_config = self.project.get_option("sentry:grouping_config")
292-
self.project.update_option("sentry:grouping_config", new_config)
293-
self.project.update_option("sentry:secondary_grouping_config", original_config)
294-
self.project.update_option(
295-
"sentry:secondary_grouping_expiry", time.time() + (24 * 90 * 3600)
296-
)

0 commit comments

Comments
 (0)