on_error hook needs corresponding on_success hook #475
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#475
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
I am currently using an selfhosted instance of healthchecks.io to monitor my backups.
The "everything" check fails, but is displayed as succeeded.
Why it is happening
You can see a picture like this for the check receiving pre_everything, post_everything and failure hooks.
The following is happening:
The result is that the failed backup is marked as success. This is a completely expected behaviour since the post_everything hook is supposted to be called in any case. But it doesn't fit to my use case.
Proposed solution
Please add an on_success hook corresponding to the on_error hook to enable users to correctly distinguish between succeeded and failed backups.
Thanks for bringing this to my attention. Two thoughts:
after_backup
hook is basically the "success" hook forcreate
actions. It's triggered when the backup has completed successfully. However...pre_everything
andpost_everything
hooks? The built-in Healthchecks integration should handle all of your use cases for transmitting successes and failures. And if it's not, it should probably be fixed!My specific use case is that I wanted to find out how much time the subtastsks backup, check and create take.
Therefore I created 4 separate healthchecks and linked them to before_, after_, pre_everything and post_everything. The on_error hook is sent to the everything check.
Using the healthchecks integration should only give me the total time of the whole borgmatic run as I understood it.
By the way my favourite solution would be having a hook for statistics. Sending some measured durations as json string via http POST. That would require templating for the http-body, but enable me to send my statistics directly to influxdb for example.
What about covering this with #473?
I apologize for the delay in getting back to this. I think I'm missing something though. "backup" and "create" are really the same thing as far as borgmatic is concerned. For that, you should be able to use the
before_backup
/after_backup
hooks. And for check, thebefore_check
/after_check
hooks should work. Similar thing if you want to time any of the other actions. That means you might not need to use the everything hooks?I agree that a statistic hook would be pretty cool.
Closing this for now, but feel free to follow up. We can always reopen it. Thanks!