Skip to content

Commit 8abef94

Browse files
evanpurkhiserAhmed-Labs
authored andcommitted
ref(crons): Update monitor incident title and subtitle (#102727)
Changes monitor incident issue title from "Monitor failure" to "Cron failure" and updates the subtitle to include the specific failure reason instead of the generic "Your monitor has reached its failure threshold" message. Fixes [NEW-552: Add Cron monitor failure reason to the event's message](https://linear.app/getsentry/issue/NEW-552/add-cron-monitor-failure-reason-to-the-events-message)
1 parent bb49f9e commit 8abef94

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/sentry/monitors/logic/incident_occurrence.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,21 @@ def send_incident_occurrence(
160160
owner_actor = None
161161
monitor_env.monitor.update(owner_user_id=None, owner_team_id=None)
162162

163+
failure_reason = get_failure_reason(previous_checkins)
164+
163165
occurrence = IssueOccurrence(
164166
id=uuid.uuid4().hex,
165167
resource_id=None,
166168
project_id=monitor_env.monitor.project_id,
167169
event_id=uuid.uuid4().hex,
168170
fingerprint=[incident.grouphash],
169171
type=MonitorIncidentType,
170-
issue_title=f"Monitor failure: {monitor_env.monitor.name}",
171-
subtitle="Your monitor has reached its failure threshold.",
172+
issue_title=f"Cron failure: {monitor_env.monitor.name}",
173+
subtitle=f"Your monitor is failing: {failure_reason}.",
172174
evidence_display=[
173175
IssueEvidence(
174176
name="Failure reason",
175-
value=str(get_failure_reason(previous_checkins)),
177+
value=str(failure_reason),
176178
important=True,
177179
),
178180
IssueEvidence(

tests/sentry/monitors/logic/test_incident_occurrence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def test_send_incident_occurrence(
106106
**{
107107
"project_id": self.project.id,
108108
"fingerprint": [self.incident.grouphash],
109-
"issue_title": f"Monitor failure: {self.monitor.name}",
110-
"subtitle": "Your monitor has reached its failure threshold.",
109+
"issue_title": f"Cron failure: {self.monitor.name}",
110+
"subtitle": "Your monitor is failing: 1 timeout and 1 error check-ins detected.",
111111
"resource_id": None,
112112
"evidence_data": {},
113113
"evidence_display": [
@@ -191,8 +191,8 @@ def test_send_incident_occurrence_detector(
191191
**{
192192
"project_id": self.project.id,
193193
"fingerprint": [self.incident.grouphash],
194-
"issue_title": f"Monitor failure: {self.monitor.name}",
195-
"subtitle": "Your monitor has reached its failure threshold.",
194+
"issue_title": f"Cron failure: {self.monitor.name}",
195+
"subtitle": "Your monitor is failing: 1 timeout and 1 error check-ins detected.",
196196
"resource_id": None,
197197
"evidence_data": {"detector_id": detector.id},
198198
"evidence_display": [

0 commit comments

Comments
 (0)