Skip to content

Commit 9f65d2d

Browse files
authored
fix(issue-platform): Make sure generic events have a title (#44974)
This uses the `issue_title` from the occurrence as the default title on the event. This allows events in discover to display a useful title. I don't think we have a case where we'll want to allow users to pass an event title that's different to the occurrence title, but we can add that if someone wants it later. Note that for perf issues, they'll be using existing transactions and so these events will just be transactions and have their original title.
1 parent 22c5caa commit 9f65d2d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/sentry/issues/json_schemas.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"tags": {"type": "object"},
1111
"timestamp": {"type": "string", "format": "date-time"},
1212
"received": {"type": "string", "format": "date-time"},
13-
# "title": {"type": "string", "minLength": 1}, leaving this out, for now
13+
"title": {"type": "string", "minLength": 1},
1414
# non-required properties
1515
"breadcrumbs": {
1616
"type": ["array", "null"],
@@ -136,6 +136,7 @@
136136
"project_id",
137137
"tags",
138138
"timestamp",
139-
], # title will be required, if enabled
139+
"title",
140+
],
140141
"additionalProperties": False,
141142
}

src/sentry/issues/occurrence_consumer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ def _get_kwargs(payload: Mapping[str, Any]) -> Mapping[str, Any]:
183183
"tags": event_payload.get("tags"),
184184
"timestamp": event_payload.get("timestamp"),
185185
"received": event_payload.get("received", timezone.now()),
186+
# This allows us to show the title consistently in discover
187+
"title": occurrence_data["issue_title"],
186188
}
187189

188190
optional_params = [

tests/sentry/issues/test_occurrence_consumer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,8 @@ def test_invalid_uuid(self) -> None:
281281
message = deepcopy(get_test_message(self.project.id))
282282
message["event"]["event_id"] = "hi"
283283
_get_kwargs(message)
284+
285+
def test_occurrence_title_on_event(self) -> None:
286+
message = deepcopy(get_test_message(self.project.id))
287+
kwargs = _get_kwargs(message)
288+
assert kwargs["occurrence_data"]["issue_title"] == kwargs["event_data"]["title"]

0 commit comments

Comments
 (0)