mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/backup/actions: update vm_backups_uploaded_bytes_total metric along the file upload instead of after the file upload
This solves two issues: 1. The vm_backups_uploaded_bytes_total metric will grow more smoothly 2. This prevents from int overflow at metrics.Counter.Add() when uploading files bigger than 2GiB
This commit is contained in:
parent
ece86cd314
commit
906a35bdbb
1 changed files with 1 additions and 1 deletions
|
@ -170,7 +170,6 @@ func runBackup(src *fslocal.FS, dst common.RemoteFS, origin common.OriginFS, con
|
|||
prc := 100 * float64(n) / float64(uploadSize)
|
||||
logger.Infof("uploaded %d out of %d bytes (%.2f%%) from %s to %s in %s", n, uploadSize, prc, src, dst, elapsed)
|
||||
})
|
||||
bytesUploadedTotal.Add(int(bytesUploaded.Load()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -191,6 +190,7 @@ type statReader struct {
|
|||
func (sr *statReader) Read(p []byte) (int, error) {
|
||||
n, err := sr.r.Read(p)
|
||||
sr.bytesRead.Add(uint64(n))
|
||||
bytesUploadedTotal.Add(int(n))
|
||||
return n, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue