|
@@ -46,36 +46,20 @@ class ShouldCallSeerTest(TestCase):
|
|
|
self.primary_hashes = self.event.get_hashes()
|
|
|
|
|
|
def test_obeys_feature_enablement_check(self):
|
|
|
- for metadata_flag, grouping_flag, backfill_completed_option, expected_result in [
|
|
|
- # TODO: This manual cartesian product business is gross, but thankfully it's temporary -
|
|
|
- # the metadata flag is about to go away and the backfill completed option will go away
|
|
|
- # once all projects are backfilled.
|
|
|
- (False, False, None, False),
|
|
|
- (True, False, None, True),
|
|
|
- (False, True, None, True),
|
|
|
- (True, True, None, True),
|
|
|
- (False, False, 11211231, True),
|
|
|
- (True, False, 11211231, True),
|
|
|
- (False, True, 11211231, True),
|
|
|
- (True, True, 11211231, True),
|
|
|
+ for grouping_flag, backfill_completed_option, expected_result in [
|
|
|
+ (False, None, False),
|
|
|
+ (True, None, True),
|
|
|
+ (False, 11211231, True),
|
|
|
+ (True, 11211231, True),
|
|
|
]:
|
|
|
- with (
|
|
|
- Feature(
|
|
|
- {
|
|
|
- "projects:similarity-embeddings-metadata": metadata_flag,
|
|
|
- "projects:similarity-embeddings-grouping": grouping_flag,
|
|
|
- }
|
|
|
- ),
|
|
|
- # Having too many cases above makes us hit the project rate limit if we don't patch this
|
|
|
- patch("sentry.grouping.ingest.seer._ratelimiting_enabled", return_value=False),
|
|
|
- ):
|
|
|
+ with Feature({"projects:similarity-embeddings-grouping": grouping_flag}):
|
|
|
self.project.update_option(
|
|
|
"sentry:similarity_backfill_completed", backfill_completed_option
|
|
|
)
|
|
|
assert (
|
|
|
should_call_seer_for_grouping(self.event, self.primary_hashes)
|
|
|
is expected_result
|
|
|
- ), f"Case (metadata {metadata_flag}, grouping {grouping_flag}, backfill completed {backfill_completed_option}) failed."
|
|
|
+ ), f"Case (grouping {grouping_flag}, backfill completed {backfill_completed_option}) failed."
|
|
|
|
|
|
@with_feature("projects:similarity-embeddings-grouping")
|
|
|
def test_obeys_content_filter(self):
|
|
@@ -186,7 +170,7 @@ class GetSeerSimilarIssuesTest(TestCase):
|
|
|
)
|
|
|
self.new_event_hashes = CalculatedHashes(["20130809201315042012311220122111"])
|
|
|
|
|
|
- @patch("sentry.grouping.ingest.seer.get_similarity_data_from_seer")
|
|
|
+ @patch("sentry.grouping.ingest.seer.get_similarity_data_from_seer", return_value=[])
|
|
|
def test_sends_expected_data_to_seer(self, mock_get_similarity_data: MagicMock):
|
|
|
new_event = Event(
|
|
|
project_id=self.project.id,
|
|
@@ -234,31 +218,6 @@ class GetSeerSimilarIssuesTest(TestCase):
|
|
|
}
|
|
|
)
|
|
|
|
|
|
- @with_feature({"projects:similarity-embeddings-grouping": False})
|
|
|
- def test_returns_metadata_but_no_group_if_seer_grouping_flag_off(self):
|
|
|
- seer_result_data = SeerSimilarIssueData(
|
|
|
- parent_hash=NonNone(self.existing_event.get_primary_hash()),
|
|
|
- parent_group_id=NonNone(self.existing_event.group_id),
|
|
|
- stacktrace_distance=0.01,
|
|
|
- message_distance=0.05,
|
|
|
- should_group=True,
|
|
|
- )
|
|
|
- expected_metadata = {
|
|
|
- "similarity_model_version": SEER_SIMILARITY_MODEL_VERSION,
|
|
|
- "request_hash": self.new_event_hashes.hashes[0],
|
|
|
- "results": [asdict(seer_result_data)],
|
|
|
- }
|
|
|
-
|
|
|
- with patch(
|
|
|
- "sentry.grouping.ingest.seer.get_similarity_data_from_seer",
|
|
|
- return_value=[seer_result_data],
|
|
|
- ):
|
|
|
- assert get_seer_similar_issues(self.new_event, self.new_event_hashes) == (
|
|
|
- expected_metadata,
|
|
|
- None, # No group returned, even though `should_group` is True
|
|
|
- )
|
|
|
-
|
|
|
- @with_feature("projects:similarity-embeddings-grouping")
|
|
|
def test_returns_metadata_and_group_if_sufficiently_close_group_found(self):
|
|
|
seer_result_data = SeerSimilarIssueData(
|
|
|
parent_hash=NonNone(self.existing_event.get_primary_hash()),
|
|
@@ -282,7 +241,6 @@ class GetSeerSimilarIssuesTest(TestCase):
|
|
|
self.existing_event.group,
|
|
|
)
|
|
|
|
|
|
- @with_feature("projects:similarity-embeddings-grouping")
|
|
|
def test_returns_metadata_but_no_group_if_similar_group_insufficiently_close(self):
|
|
|
seer_result_data = SeerSimilarIssueData(
|
|
|
parent_hash=NonNone(self.existing_event.get_primary_hash()),
|
|
@@ -306,7 +264,6 @@ class GetSeerSimilarIssuesTest(TestCase):
|
|
|
None,
|
|
|
)
|
|
|
|
|
|
- @with_feature("projects:similarity-embeddings-grouping")
|
|
|
def test_returns_no_group_and_empty_metadata_if_no_similar_group_found(self):
|
|
|
expected_metadata = {
|
|
|
"similarity_model_version": SEER_SIMILARITY_MODEL_VERSION,
|