fix(seer grouping): Handle Seer returning grouphash with no group
We have lately run into an issue where Seer is recommending hashes with no group attached to them, which has highlighted a) the fact that this is even a possibility, and b) the fact that though we've been talking about Seer sometimes recommending non-existent groups, in fact all we check for is the existence of the grouphash. (The assumption there being that all grouphashes point to a group. If everything else is working correctly that should be true, but clearly stuff happens.)
This PR therefore makes two changes:
-
Change the
SimilarGroupNotFoundErrorto be aSimilarHashNotFoundError, to more accurately reflect the situation when it arises. -
Add a new
SimilarHashMissingGroupErrorto denote the case described above, so that we can track it rather than silently swallowing the problem.
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time.
:x: Failed Test Results:
Completed 21726 tests with 3 failed, 21522 passed and 201 skipped.
View the full list of failed tests
pytest
-
Class name: tests.sentry.api.endpoints.test_group_similar_issues_embeddings.GroupSimilarIssuesEmbeddingsTest
Test name: test_nonexistent_group Flags:- backend
#x1B[1m#x1B[.../api/endpoints/test_group_similar_issues_embeddings.py#x1B[0m:410: in test_nonexistent_group
mock_metrics_incr.assert_any_call(
#x1B[1m#x1B[.../hostedtoolcache/Python/3.11.8.../x64/lib/python3.11/unittest/mock.py#x1B[0m:1010: in assert_any_call
raise AssertionError(
#x1B[1m#x1B[31mE AssertionError: incr('seer.similar_issues_request', sample_rate=1.0, tags={'response_status': 200, 'outcome': 'error', 'error': 'SimilarGroupNotFoundError', 'referrer': 'similar_issues'}) call not found#x1B[0m - backend
-
Class name: tests.sentry.seer.similarity.test_similar_issues.GetSimilarityDataFromSeerTest
Test name: test_bad_response_data Flags:- backend
#x1B[1m#x1B[.../seer/similarity/test_similar_issues.py#x1B[0m:143: in test_bad_response_data
mock_metrics_incr.assert_any_call(
#x1B[1m#x1B[.../hostedtoolcache/Python/3.11.8.../x64/lib/python3.11/unittest/mock.py#x1B[0m:1010: in assert_any_call
raise AssertionError(
#x1B[1m#x1B[31mE AssertionError: incr('seer.similar_issues_request', sample_rate=1.0, tags={'response_status': 200, 'outcome': 'error', 'error': 'SimilarGroupNotFoundError'}) call not found#x1B[0m - backend
-
Class name: tests.sentry.tasks.test_backfill_seer_grouping_records.TestBackfillSeerGroupingRecords
Test name: test_backfill_seer_grouping_records_groups_has_invalid_neighbor Flags:- backend
#x1B[1m#x1B[.../sentry/tasks/test_backfill_seer_grouping_records.py#x1B[0m:1001: in test_backfill_seer_grouping_records_groups_has_invalid_neighbor
mock_logger.exception.assert_called_with(
#x1B[1m#x1B[.../hostedtoolcache/Python/3.11.8.../x64/lib/python3.11/unittest/mock.py#x1B[0m:939: in assert_called_with
raise AssertionError(_error_message()) from cause
#x1B[1m#x1B[31mE AssertionError: expected call not found.#x1B[0m
#x1B[1m#x1B[31mE Expected: exception('tasks.backfill_seer_grouping_records.invalid_parent_group', extra={'project_id': 4554491426766850, 'group_id': 437, 'parent_hash': '00000000000000000000000000000000'})#x1B[0m
#x1B[1m#x1B[31mE Actual: exception('tasks.backfill_seer_grouping_records.invalid_parent_group', extra={'project_id': 4554491426766850, 'group_id': 437, 'parent_hash': '00000000000000000000000000000000', 'error': SimilarHashNotFoundError('Similar hash suggested by Seer does not exist')})#x1B[0m - backend
Suspect Issues
This pull request was deployed and Sentry observed the following issues:
- ‼️ SimilarHashNotFoundError: Similar hash suggested by Seer does not exist
sentry.tasks.backfill_seer_grouping_recordsView Issue
Did you find this useful? React with a 👍 or 👎