Skip to content

Commit 2f501d4

Browse files
roggenkemperandrewshie-sentry
authored andcommitted
fix(llm-detector): Update how transaction/trace are sent in occurrence (#103091)
this pr updates the llm issue detection to now send trace/transaction as tags - because they weren't being sent as event data, the span evidence section wasn't working for these issues fixes https://linear.app/getsentry/issue/ID-1079/fix-span-evidence-section-on-issue-details
1 parent 1a71f01 commit 2f501d4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/sentry/tasks/llm_issue_detection.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,12 @@ def create_issue_occurrence_from_detection(
129129
"platform": project.platform or "other",
130130
"received": detection_time.isoformat(),
131131
"timestamp": detection_time.isoformat(),
132-
"tags": {
133-
"trace_id": trace.trace_id,
134-
"transaction": transaction_name,
132+
"transaction": transaction_name,
133+
"contexts": {
134+
"trace": {
135+
"trace_id": trace.trace_id,
136+
"type": "trace",
137+
}
135138
},
136139
}
137140

tests/sentry/tasks/test_llm_issue_detection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def test_create_issue_occurrence_from_detection(self, mock_produce_occurrence):
118118
event_data = call_kwargs["event_data"]
119119
assert event_data["project_id"] == self.project.id
120120
assert event_data["platform"] == "other"
121-
assert event_data["tags"]["trace_id"] == "abc123xyz"
122-
assert event_data["tags"]["transaction"] == "test_transaction"
121+
assert event_data["contexts"]["trace"]["trace_id"] == "abc123xyz"
123122
assert "event_id" in event_data
124123
assert "received" in event_data
125124
assert "timestamp" in event_data

0 commit comments

Comments
 (0)