Skip to content

Retain probe failures beyond 24 hours, 30 days or 1000#38

Merged
lewispb merged 4 commits intomainfrom
retain-failures-for-longer
Mar 10, 2026
Merged

Retain probe failures beyond 24 hours, 30 days or 1000#38
lewispb merged 4 commits intomainfrom
retain-failures-for-longer

Conversation

@lewispb
Copy link
Member

@lewispb lewispb commented Mar 10, 2026

Given that failures should be less likely than successes we should retain results for longer so that we can troubleshoot after the fact.

Copilot AI review requested due to automatic review settings March 10, 2026 09:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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::StaleCleanup concern with differentiated retention policies for successes (24h) and failures (30 days / 1000 records).
  • Replaced the old Upright::ProbeResult.stale.in_batches.destroy_all recurring job command with the new Upright::ProbeResult.cleanup_stale method 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.

Copilot AI review requested due to automatic review settings March 10, 2026 09:40
@lewispb lewispb merged commit 1ecb524 into main Mar 10, 2026
9 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@lewispb lewispb deleted the retain-failures-for-longer branch March 10, 2026 13:01
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