mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 18:43:50 +00:00
rc: add srcFs and dstFs to core/stats and core/transferred stats
Before this change it wasn't possible to see where transfers were going from and to in core/stats and core/transferred. When use in rclone mount in particular this made interpreting the stats very hard.
This commit is contained in:
@@ -339,7 +339,7 @@ func (d *driver) ListDir(sctx *ftp.Context, path string, callback func(iofs.File
|
||||
}
|
||||
|
||||
// Account the transfer
|
||||
tr := accounting.GlobalStats().NewTransferRemoteSize(path, node.Size())
|
||||
tr := accounting.GlobalStats().NewTransferRemoteSize(path, node.Size(), d.f, nil)
|
||||
defer func() {
|
||||
tr.Done(d.ctx, err)
|
||||
}()
|
||||
@@ -448,7 +448,7 @@ func (d *driver) GetFile(sctx *ftp.Context, path string, offset int64) (size int
|
||||
}
|
||||
|
||||
// Account the transfer
|
||||
tr := accounting.GlobalStats().NewTransferRemoteSize(path, node.Size())
|
||||
tr := accounting.GlobalStats().NewTransferRemoteSize(path, node.Size(), d.f, nil)
|
||||
defer tr.Done(d.ctx, nil)
|
||||
|
||||
return node.Size(), handle, nil
|
||||
|
||||
@@ -297,7 +297,7 @@ func (s *HTTP) serveFile(w http.ResponseWriter, r *http.Request, remote string)
|
||||
}()
|
||||
|
||||
// Account the transfer
|
||||
tr := accounting.Stats(r.Context()).NewTransfer(obj)
|
||||
tr := accounting.Stats(r.Context()).NewTransfer(obj, nil)
|
||||
defer tr.Done(r.Context(), nil)
|
||||
// FIXME in = fs.NewAccount(in, obj).WithBuffer() // account the transfer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user