-
Notifications
You must be signed in to change notification settings - Fork 33
Prune resolved errors #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
odarriba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comments. Overall looks good but I'm not sure if it covers all the functionality needed and if the options are the optimal ones.
Let me know what do you think @crbelaus
Default max age is 24h and default limit is 200 errors.
This column is used by the pruner so having an index improves the query performance.
|
Should be ready to review again @odarriba |
odarriba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only needed change is adding the -1 to calculating the filter timestamp.
Aside from that we could also use some tests of this plugin to ensure its behaviour does not change in the future.
odarriba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🇮🇹
This pull request adds a new
ErrorTracker.Plugins.Prunerwhich automatically prunes resolved errors. This plugin can be used automatically or manually.ℹ️ I've also added a new priv/repo/seeds.exs script that populates the db with some fake errors and occurrences. May be useful for testing the dashboard, pruning and other features easily.
Automatic use
Register the plugin under the ErrorTracker configuration. The pruner will run in the background every 30 minutes and remove up to 1000 resolved errors older than 5 minutes (this options can be overriden)
Manual use
If you want to have more fine-grained control over when the pruner runs you can use the
ErrorTracker.Plugins.Pruner.prune_errors/1function. In this case you must pass the:limitand:max_ageoptions explicitly.You may want to call this function from an Oban job to leverage its cron-like capabilities.
Closes #64