ref(crons): Reorganize incident creation / issue occurrence logic#13
Open
ShashankFC wants to merge 1 commit into
Open
ref(crons): Reorganize incident creation / issue occurrence logic#13ShashankFC wants to merge 1 commit into
ShashankFC wants to merge 1 commit into
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
There was a problem hiding this comment.
Pull request overview
This PR refactors the monitor incident creation and issue occurrence logic by extracting functionality from mark_failed.py into two new, more focused modules: incidents.py and incident_occurrence.py. The reorganization improves code modularity and separation of concerns.
Changes:
- Extracted incident threshold checking logic into a new
try_incident_thresholdfunction inincidents.py - Moved issue occurrence creation logic into a new
create_incident_occurrencefunction inincident_occurrence.py - Added
SimpleCheckInTypedDict totypes.pyfor shared type definition
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/sentry/monitors/types.py | Added SimpleCheckIn TypedDict to provide a shared type definition for stripped-down check-in objects |
| src/sentry/monitors/logic/mark_failed.py | Simplified by removing incident creation logic and delegating to new try_incident_threshold function |
| src/sentry/monitors/logic/incidents.py | New module containing extracted incident threshold checking and creation logic |
| src/sentry/monitors/logic/incident_occurrence.py | New module containing extracted issue occurrence creation logic and helper functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| def get_failure_reason(failed_checkins: Sequence[SimpleCheckIn]): | ||
| """ | ||
| Builds a humam readible string from a list of failed check-ins. |
There was a problem hiding this comment.
Corrected spelling of 'humam' to 'human'.
Suggested change
| Builds a humam readible string from a list of failed check-ins. | |
| Builds a human readable string from a list of failed check-ins. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test 8
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.
Replicated from ai-code-review-evaluation/sentry-coderabbit#8