|
@@ -79,7 +79,7 @@ class SharedSnubaTest(TestCase, SnubaTestCase):
|
|
|
if limit is not None:
|
|
|
kwargs["limit"] = limit
|
|
|
if aggregate_kwargs:
|
|
|
- kwargs["aggregate_kwargs"] = {"better_priority": {**aggregate_kwargs}}
|
|
|
+ kwargs["aggregate_kwargs"] = {"priority": {**aggregate_kwargs}}
|
|
|
|
|
|
return self.backend.query(
|
|
|
projects,
|
|
@@ -364,7 +364,7 @@ class EventsSnubaSearchTest(SharedSnubaTest):
|
|
|
results = self.make_query(sort_by="user")
|
|
|
assert list(results) == [self.group1, self.group2]
|
|
|
|
|
|
- def test_better_priority_sort(self):
|
|
|
+ def test_priority_sort(self):
|
|
|
weights: PrioritySortWeights = {
|
|
|
"log_level": 5,
|
|
|
"has_stacktrace": 5,
|
|
@@ -375,7 +375,7 @@ class EventsSnubaSearchTest(SharedSnubaTest):
|
|
|
"norm": False,
|
|
|
}
|
|
|
results = self.make_query(
|
|
|
- sort_by="betterPriority",
|
|
|
+ sort_by="priority",
|
|
|
aggregate_kwargs=weights,
|
|
|
)
|
|
|
assert list(results) == [self.group2, self.group1]
|
|
@@ -2597,12 +2597,12 @@ class EventsSnubaSearchTest(SharedSnubaTest):
|
|
|
assert len(results) == 0
|
|
|
|
|
|
|
|
|
-class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
+class EventsPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
@property
|
|
|
def backend(self):
|
|
|
return EventsDatasetSnubaSearchBackend()
|
|
|
|
|
|
- def test_better_priority_sort_old_and_new_events(self):
|
|
|
+ def test_priority_sort_old_and_new_events(self):
|
|
|
"""Test that an issue with only one old event is ranked lower than an issue with only one new event"""
|
|
|
new_project = self.create_project(organization=self.project.organization)
|
|
|
base_datetime = (datetime.utcnow() - timedelta(days=3)).replace(tzinfo=pytz.utc)
|
|
@@ -2644,7 +2644,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
"norm": False,
|
|
|
}
|
|
|
results = self.make_query(
|
|
|
- sort_by="betterPriority",
|
|
|
+ sort_by="priority",
|
|
|
projects=[new_project],
|
|
|
aggregate_kwargs=weights,
|
|
|
)
|
|
@@ -2652,7 +2652,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
old_group = Group.objects.get(id=old_event.group.id)
|
|
|
assert list(results) == [recent_group, old_group]
|
|
|
|
|
|
- def test_better_priority_sort_v2(self):
|
|
|
+ def test_priority_sort_v2(self):
|
|
|
"""Test that the v2 formula works."""
|
|
|
new_project = self.create_project(organization=self.project.organization)
|
|
|
base_datetime = (datetime.utcnow() - timedelta(days=3)).replace(tzinfo=pytz.utc)
|
|
@@ -2694,7 +2694,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
"norm": False,
|
|
|
}
|
|
|
results = self.make_query(
|
|
|
- sort_by="betterPriority",
|
|
|
+ sort_by="priority",
|
|
|
projects=[new_project],
|
|
|
aggregate_kwargs=weights,
|
|
|
)
|
|
@@ -2702,7 +2702,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
old_group = Group.objects.get(id=old_event.group.id)
|
|
|
assert list(results) == [recent_group, old_group]
|
|
|
|
|
|
- def test_better_priority_log_level_results(self):
|
|
|
+ def test_priority_log_level_results(self):
|
|
|
"""Test that the scoring results change when we pass in different log level weights"""
|
|
|
base_datetime = (datetime.utcnow() - timedelta(hours=1)).replace(tzinfo=pytz.utc)
|
|
|
event1 = self.store_event(
|
|
@@ -2733,7 +2733,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
group2 = Group.objects.get(id=event2.group.id)
|
|
|
|
|
|
agg_kwargs = {
|
|
|
- "better_priority": {
|
|
|
+ "priority": {
|
|
|
"log_level": 0,
|
|
|
"has_stacktrace": 0,
|
|
|
"relative_volume": 1,
|
|
@@ -2749,7 +2749,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[group1.id, group2.id],
|
|
|
limit=150,
|
|
@@ -2760,14 +2760,14 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
# initially group 2's score is higher since it has a more recent event
|
|
|
assert group2_score_before > group1_score_before
|
|
|
|
|
|
- agg_kwargs["better_priority"].update({"log_level": 5})
|
|
|
+ agg_kwargs["priority"].update({"log_level": 5})
|
|
|
|
|
|
results2 = query_executor.snuba_search(
|
|
|
start=None,
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[group1.id, group2.id],
|
|
|
limit=150,
|
|
@@ -2778,11 +2778,11 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
# ensure fatal has a higher score than error
|
|
|
assert group1_score_after > group2_score_after
|
|
|
|
|
|
- def test_better_priority_has_stacktrace_results(self):
|
|
|
+ def test_priority_has_stacktrace_results(self):
|
|
|
"""Test that the scoring results change when we pass in different has_stacktrace weights"""
|
|
|
base_datetime = (datetime.utcnow() - timedelta(hours=1)).replace(tzinfo=pytz.utc)
|
|
|
agg_kwargs = {
|
|
|
- "better_priority": {
|
|
|
+ "priority": {
|
|
|
"log_level": 0,
|
|
|
"has_stacktrace": 0,
|
|
|
"relative_volume": 1,
|
|
@@ -2833,7 +2833,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[group1.id, group2.id],
|
|
|
limit=150,
|
|
@@ -2843,13 +2843,13 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
group2_score = results[1][1]
|
|
|
assert group1_score == group2_score
|
|
|
|
|
|
- agg_kwargs["better_priority"].update({"has_stacktrace": 3})
|
|
|
+ agg_kwargs["priority"].update({"has_stacktrace": 3})
|
|
|
results = query_executor.snuba_search(
|
|
|
start=None,
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[group1.id, group2.id],
|
|
|
limit=150,
|
|
@@ -2860,7 +2860,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
# check that a group with an event with a stacktrace has a higher weight than one without
|
|
|
assert group1_score < group2_score
|
|
|
|
|
|
- def test_better_priority_event_halflife_results(self):
|
|
|
+ def test_priority_event_halflife_results(self):
|
|
|
"""Test that the scoring results change when we pass in different event halflife weights"""
|
|
|
base_datetime = (datetime.utcnow() - timedelta(hours=1)).replace(tzinfo=pytz.utc)
|
|
|
event1 = self.store_event(
|
|
@@ -2891,7 +2891,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
group2 = Group.objects.get(id=event2.group.id)
|
|
|
|
|
|
agg_kwargs = {
|
|
|
- "better_priority": {
|
|
|
+ "priority": {
|
|
|
"log_level": 0,
|
|
|
"has_stacktrace": 0,
|
|
|
"relative_volume": 1,
|
|
@@ -2907,7 +2907,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[group1.id, group2.id],
|
|
|
limit=150,
|
|
@@ -2918,13 +2918,13 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
# initially group 2's score is higher since it has a more recent event
|
|
|
assert group2_score_before > group1_score_before
|
|
|
|
|
|
- agg_kwargs["better_priority"].update({"event_halflife_hours": 2})
|
|
|
+ agg_kwargs["priority"].update({"event_halflife_hours": 2})
|
|
|
results = query_executor.snuba_search(
|
|
|
start=None,
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[group1.id, group2.id],
|
|
|
limit=150,
|
|
@@ -2934,7 +2934,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
group2_score_after = results[1][1]
|
|
|
assert group1_score_after < group2_score_after
|
|
|
|
|
|
- def test_better_priority_mixed_group_types(self):
|
|
|
+ def test_priority_mixed_group_types(self):
|
|
|
base_datetime = (datetime.utcnow() - timedelta(hours=1)).replace(tzinfo=pytz.utc)
|
|
|
|
|
|
error_event = self.store_event(
|
|
@@ -2967,7 +2967,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
profile_group_1 = group_info.group
|
|
|
|
|
|
agg_kwargs = {
|
|
|
- "better_priority": {
|
|
|
+ "priority": {
|
|
|
"log_level": 0,
|
|
|
"has_stacktrace": 0,
|
|
|
"relative_volume": 1,
|
|
@@ -2989,7 +2989,7 @@ class EventsBetterPriorityTest(SharedSnubaTest, OccurrenceTestMixin):
|
|
|
end=None,
|
|
|
project_ids=[self.project.id],
|
|
|
environment_ids=[],
|
|
|
- sort_field="better_priority",
|
|
|
+ sort_field="priority",
|
|
|
organization=self.organization,
|
|
|
group_ids=[profile_group_1.id, error_group.id],
|
|
|
limit=150,
|