Skip to content

Commit

Permalink
chore(seer grouping): Improve logging of Seer results (#76006)
Browse files Browse the repository at this point in the history
This makes two small changes to the logs we send when getting results from Seer:

- Send the result data as JSON rather than as a list of `SeerSimilarIssueData` repr strings. (This will make it a little easier to search in GCP.)

- Include the event id when logging problematic Seer responses (ones which point to non-existent or orphan grouphashes).
  • Loading branch information
lobsterkatie authored Aug 12, 2024
1 parent c23347e commit 47a1134
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sentry/grouping/ingest/seer.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ def get_seer_similar_issues(

# Similar issues are returned with the closest match first
seer_results = get_similarity_data_from_seer(request_data)
seer_results_json = [asdict(result) for result in seer_results]
similar_issues_metadata = {
"results": [asdict(result) for result in seer_results],
"results": seer_results_json,
"similarity_model_version": SEER_SIMILARITY_MODEL_VERSION,
}
parent_grouphash = (
Expand All @@ -224,7 +225,7 @@ def get_seer_similar_issues(
"event_id": event.event_id,
"project_id": event.project.id,
"hash": event_hash,
"results": seer_results,
"results": seer_results_json,
"grouphash_returned": bool(parent_grouphash),
},
)
Expand Down
3 changes: 3 additions & 0 deletions src/sentry/seer/similarity/similar_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def get_similarity_data_from_seer(
Request similar issues data from seer and normalize the results. Returns similar groups
sorted in order of descending similarity.
"""
event_id = similar_issues_request["event_id"]
project_id = similar_issues_request["project_id"]
request_hash = similar_issues_request["hash"]
referrer = similar_issues_request.get("referrer")
Expand Down Expand Up @@ -191,6 +192,7 @@ def get_similarity_data_from_seer(
"hash": request_hash,
"parent_hash": parent_hash,
"project_id": project_id,
"event_id": event_id,
},
)
except SimilarHashMissingGroupError:
Expand All @@ -210,6 +212,7 @@ def get_similarity_data_from_seer(
"hash": request_hash,
"parent_hash": parent_hash,
"project_id": project_id,
"event_id": event_id,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ def test_nonexistent_grouphash(
"hash": NonNone(self.event.get_primary_hash()),
"parent_hash": "not a real hash",
"project_id": self.project.id,
"event_id": self.event.event_id,
},
)
mock_seer_deletion_request.delay.assert_called_with(self.project.id, ["not a real hash"])
Expand Down Expand Up @@ -482,6 +483,7 @@ def test_grouphash_with_no_group(
"hash": NonNone(self.event.get_primary_hash()),
"parent_hash": "dogs are great",
"project_id": self.project.id,
"event_id": self.event.event_id,
},
)

Expand Down

0 comments on commit 47a1134

Please sign in to comment.