forked from knyar/prometheus-remote-backfill
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
promdump: Improve handling for fatal errors
Added a new func called writeErrIsFatal that accepts an error and returns true or false, depending whether the error encountered should abort execution. Examples of fatal write errors include running out of disk space and permissions issues. The utility should not attempt to continue writing if it encounters such a fatal error. The list of fatal errors can continue to be expanded / refined in future. This new func is called from exportMetric if an error is returned from the writeFile func. If an error considered fatal is encountered, the program aborts with a fatal message. Non-fatal errors are returned to the caller. Made some minor style changes to error messages as suggested by the linter. Changed out the pattern errors.New(fmt.Sprintf("...")) for the more concise fmt.Errorf("...") throughout. Added error wrapping using fmt.Errorf("...: %w",err) where appropriate to avoid stripping context as errors bubble up the stack. Changed allocation for slices used to track filename conflicts so they are no longer allocated empty, requiring an immediate expansion.
- Loading branch information
1 parent
a56276b
commit 28b088b
Showing
1 changed file
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters