From 477fc4348551a86844fb6813aadcbdf0afd42d14 Mon Sep 17 00:00:00 2001 From: Vaibhav Kamra Date: Tue, 14 Nov 2023 00:18:27 -0800 Subject: [PATCH] Add progress logging to uploader (#4672) Adds a progress log in the kopia upload that logs every 10000 files that have been uploaded. This is useful to track progress of large backups. --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [x] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * #4670 #### Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/kopia/upload.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/internal/kopia/upload.go b/src/internal/kopia/upload.go index bbdcc46c3..6c103d353 100644 --- a/src/internal/kopia/upload.go +++ b/src/internal/kopia/upload.go @@ -57,6 +57,7 @@ type corsoProgress struct { toMerge *mergeDetails mu sync.RWMutex totalBytes int64 + totalFiles int64 errs *fault.Bus counter *count.Bus // expectedIgnoredErrors is a count of error cases caught in the Error wrapper @@ -91,6 +92,13 @@ func (cp *corsoProgress) FinishedFile(relativePath string, err error) { return } + atomic.AddInt64(&cp.totalFiles, 1) + + // Log every 1000 items uploaded + if cp.totalFiles%1000 == 0 { + logger.Ctx(cp.ctx).Infow("finishedfile", "totalFiles", cp.totalFiles, "totalBytes", cp.totalBytes) + } + d := cp.get(relativePath) if d == nil { return