Skip to content

Commit fa5d13f

Browse files
committed
fix(uptime): two possible fixes for cron monitor incident timing inconsistency
1 parent f573927 commit fa5d13f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sentry/monitors/logic/incident_occurrence.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ def send_incident_occurrence(
217217
"monitor.slug": str(monitor_env.monitor.slug),
218218
"monitor.incident": str(incident.id),
219219
},
220+
# option 1: timestamp <- received.isoformat(). This seems reasonable, because the cron incident starts not when
221+
# we've processed it, but when relay got the message (which is approximately when the cron failure occurred.)
220222
"timestamp": current_timestamp.isoformat(),
221223
}
222224

@@ -293,6 +295,8 @@ def resolve_incident_group(incident: MonitorIncident, project_id: int) -> None:
293295
project_id=project_id,
294296
new_status=GroupStatus.RESOLVED,
295297
new_substatus=None,
298+
# option 2: make this current_time. Then, because of monitor ordering guarantees, this will always be ahead of
299+
# the start time
296300
update_date=incident.resolving_timestamp,
297301
)
298302
produce_occurrence_to_kafka(

0 commit comments

Comments
 (0)