-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
migration(crons): Add MonitorIncident table #56403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/sentry/monitors/models.py
Outdated
opening_checkin = FlexibleForeignKey("sentry.MonitorCheckIn", related_name="created_incidents") | ||
closing_checkin = FlexibleForeignKey( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These feel like misnomers, I think we probably want 'starting_checkinand
resolved_checkin`
and for good measure, we should probably add some comments to these fields to clearly indicate which checkins in the lifecycle of an incident these would be.
Also Important, these should probably be nullablabe since the checkins will be removed, in which case, I think we almost definitely would probably want to either
- Also remove the incident when any checkins are removed
- Keep start and end date and allow empty start and end check ins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
closing_checkin = FlexibleForeignKey( | ||
"sentry.MonitorCheckIn", related_name="closed_incidents", null=True | ||
) | ||
grouphash = models.CharField(max_length=32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use a UUID field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess but wanted to keep it consistent with
sentry/src/sentry/models/grouphash.py
Line 25 in 2cba1ab
hash = models.CharField(max_length=32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Closing in favor of #56435 |
Adds
MonitorIncidentTable
to keep track of open monitor incidents + display them on the timeline view.If a
failure
threshold is set, we will open anincident
and tag it with the appropriatehash
and reference thecheckin
that caused it to pass the threshold.If a
recovery
threshold is set, we will find anyincident
with the appropriatehash
and set it as theclosing_checkin
.In the future, if no thresholds are set, we will move to this behavior. But for now, we will keep existing behavior as-is.
The
thresholds
can be derived from thecheckin
configs, though we may want to add them as top level fields.Closes #56402