ref(crons): Reorganize incident creation / issue occurrence logic#10
Open
zaibkhan wants to merge 1 commit into
Open
ref(crons): Reorganize incident creation / issue occurrence logic#10zaibkhan wants to merge 1 commit into
zaibkhan 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
Codoki PR ReviewSummary: Refactor incidents/occurrence flow, fix context config usage
Issues (Medium)
Showing up to 1 medium issue(s). See inline suggestions for more details. Key Feedback (click to expand)
Confidence: 4/5 — Looks good; minor fixes (1 medium) Sequence DiagramsequenceDiagram
participant Caller
participant MarkFailed
participant Incidents
participant Occurrence
participant Kafka
participant Signals
Caller->>MarkFailed: mark_failed(failed_checkin, ts, received)
MarkFailed->>Incidents: try_incident_threshold(failed_checkin, threshold, received)
alt status OK/ACTIVE and threshold met
Incidents-->>Incidents: set status ERROR, get_or_create incident
else status ERROR
Incidents-->>Incidents: use active incident
else other statuses
Incidents-->>MarkFailed: return False
end
alt not muted and incident exists
loop for each checkin in window
Incidents->>Occurrence: create_incident_occurrence(...)
Occurrence->>Kafka: produce_occurrence_to_kafka(...)
end
end
Incidents->>Signals: monitor_environment_failed.send(...)
Incidents-->>MarkFailed: return True
React with 👍 or 👎 if you found this review useful. |
| "id": str(monitor_environment.monitor.guid), | ||
| "slug": str(monitor_environment.monitor.slug), | ||
| "name": monitor_environment.monitor.name, | ||
| "config": monitor_environment.monitor.config, |
There was a problem hiding this comment.
🔷 Medium: The function creates a local copy of config and updates schedule_type to its display value, but returns the original unmodified config here. This drops the intended display mapping and may show raw/internal values to downstream consumers.
Suggested change
| "config": monitor_environment.monitor.config, | |
| ```suggestion | |
| "config": config, |
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.
Mirrors ai-code-review-evaluation#8 for like-for-like benchmarking.
monitor-incident-refactor-beforemonitor-incident-refactor-afterOriginal PR excerpt: