mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 07:19:17 +01: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
0ac1c533dc
commit
510e3d9cda
@ -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 New Issue
Block a user