sftpgo
sftpgo copied to clipboard
metric: treat io.EOF as successful upload, not an error
This pull request introduces enhancements to the internal/metric/metric.go file, focusing on error handling and dependency updates. The changes improve the robustness of metrics tracking by accounting for additional error scenarios and updating imports.
Error handling improvements:
- Modified the
TransferCompletedfunction to incrementtotalUploadseven when the error isio.EOF, ensuring proper metrics tracking for completed transfers despite this specific error condition.
Dependency updates:
- Added imports for
errorsandiopackages to support the new error handling logic in theTransferCompletedfunction.Uploads that end with io.EOF are now considered successful and no longer increment the upload error metric. This aligns metric reporting with Go convention, where io.EOF indicates normal completion rather than an error.
Checklist for Pull Requests
- [x] Have you signed the Contributor License Agreement?
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
lushenle seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
If an upload returns EOF, you will have a partial file or no file at all, depending on the storage backend and the SFTPGo configuration