Retain probe failures beyond 24 hours, 30 days or 1000#38
Conversation
There was a problem hiding this comment.
Pull request overview
This PR changes the cleanup strategy for Upright::ProbeResult records so that failures are retained for longer than successes, making it easier to troubleshoot issues after the fact. Previously, all records (regardless of status) were cleaned up after 24 hours. Now successes are still purged after 24 hours, while failures are kept for up to 30 days or a maximum of 1000 records, whichever results in fewer retained records.
Changes:
- Extracted the stale record cleanup logic into a new
Upright::ProbeResult::StaleCleanupconcern with differentiated retention policies for successes (24h) and failures (30 days / 1000 records). - Replaced the old
Upright::ProbeResult.stale.in_batches.destroy_allrecurring job command with the newUpright::ProbeResult.cleanup_stalemethod in both the install template and the dummy app config.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
app/models/concerns/upright/probe_result/stale_cleanup.rb |
New concern implementing differentiated retention logic for success and failure records |
app/models/upright/probe_result.rb |
Includes the new StaleCleanup concern |
lib/generators/upright/install/templates/recurring.yml |
Updates the cleanup command in the install template |
test/dummy/config/recurring.yml |
Updates the cleanup command in the test app's recurring config |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Given that failures should be less likely than successes we should retain results for longer so that we can troubleshoot after the fact.