Reorganize incident creation / issue occurrence logic#8
Conversation
…0528) Since we'll be doing more with issue occurrences split out the concept of incidents into it's own logic module, as well as incident_occurrence into it's own module Part of GH-80527
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
User description
PR #8
PR Type
Enhancement
Description
Extract incident creation logic into dedicated
incidents.pymoduleExtract incident occurrence logic into dedicated
incident_occurrence.pymoduleMove
SimpleCheckIntype definition totypes.pyfor reusabilitySimplify
mark_failed.pyby delegating to newtry_incident_thresholdfunctionDiagram Walkthrough
File Walkthrough
incident_occurrence.py
New incident occurrence creation logic modulesrc/sentry/monitors/logic/incident_occurrence.py
create_incident_occurrence()function to produce Kafkaevents
get_failure_reason()andget_monitor_environment_context()incidents.py
New incident threshold and creation logic modulesrc/sentry/monitors/logic/incidents.py
try_incident_threshold()function to handle incident statetransitions
create_incident_occurrence()for event productionmark_failed.py
Refactor to delegate incident logic to new modulessrc/sentry/monitors/logic/mark_failed.py
SimpleCheckInTypedDict definitionget_failure_reason(),get_monitor_environment_context()try_incident_threshold()function
types.py
Add SimpleCheckIn type definition for reusesrc/sentry/monitors/types.py
SimpleCheckInTypedDict definition with fields:id,date_added,status