Skip to content

ref(crons): Reorganize incident creation / issue occurrence logic#13

Open
ShashankFC wants to merge 1 commit into
monitor-incident-refactor-beforefrom
monitor-incident-refactor-after
Open

ref(crons): Reorganize incident creation / issue occurrence logic#13
ShashankFC wants to merge 1 commit into
monitor-incident-refactor-beforefrom
monitor-incident-refactor-after

Conversation

@ShashankFC

@ShashankFC ShashankFC commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Test 8

Summary by CodeRabbit

Release Notes

  • New Features
    • Implemented automatic incident creation and detection for monitor failures, respecting configurable failure thresholds.
    • Enhanced incident context with human-readable failure reason summaries, environment details, and tracking of last successful check-in times to aid in incident diagnosis and resolution.

✏️ Tip: You can customize this high-level summary in your review settings.


Replicated from ai-code-review-evaluation/sentry-coderabbit#8


Note

Medium Risk
Behavior should be largely preserved but the refactor touches incident creation, environment status transitions, and Kafka occurrence emission, so regressions could affect alerting/issue generation.

Overview
Refactors monitor failure incident handling by moving threshold evaluation and incident lifecycle logic out of mark_failed.py into try_incident_threshold (logic/incidents.py).

Extracts issue-platform occurrence creation into logic/incident_occurrence.py, including monitor context building and human-readable failure-reason generation, and updates mark_failed to delegate to the new flow. Also promotes SimpleCheckIn into monitors/types.py for shared use.

Written by Cursor Bugbot for commit c3b32a7. Configure here.

…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
@ShashankFC

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

"id": str(monitor_environment.monitor.guid),
"slug": str(monitor_environment.monitor.slug),
"name": monitor_environment.monitor.name,
"config": monitor_environment.monitor.config,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local config copy is never used in return

Medium Severity

In get_monitor_environment_context, a local config copy is created and the schedule_type key is replaced with a human-readable display value, but the return dict on line 168 uses the original monitor_environment.monitor.config instead of the local config variable. The schedule_type transformation is effectively dead code, and the monitor context will always contain the raw schedule_type value instead of the display-friendly one.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants