Skip to content

Commit d81ffd8

Browse files
committed
[ws-daemon] log download and extract times
1 parent cf4f468 commit d81ffd8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/ws-daemon/pkg/content/initializer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,15 @@ func (rs *remoteContentStorage) Download(ctx context.Context, destination string
406406
"-o", tempFile.Name(),
407407
}
408408

409+
downloadStart := time.Now()
409410
cmd := exec.Command("aria2c", args...)
410411
out, err := cmd.CombinedOutput()
411412
if err != nil {
412413
log.WithError(err).WithField("out", string(out)).Error("unexpected error downloading file")
413414
return true, xerrors.Errorf("unexpected error downloading file")
414415
}
416+
downloadDuration := time.Since(downloadStart)
417+
log.WithField("downloadDuration", downloadDuration.String()).Info("aria2c download duration")
415418

416419
tempFile, err = os.Open(tempFile.Name())
417420
if err != nil {
@@ -421,10 +424,13 @@ func (rs *remoteContentStorage) Download(ctx context.Context, destination string
421424
defer os.Remove(tempFile.Name())
422425
defer tempFile.Close()
423426

427+
extractStart := time.Now()
424428
err = archive.ExtractTarbal(ctx, tempFile, destination, archive.WithUIDMapping(mappings), archive.WithGIDMapping(mappings))
425429
if err != nil {
426430
return true, xerrors.Errorf("tar %s: %s", destination, err.Error())
427431
}
432+
extractDuration := time.Since(extractStart)
433+
log.WithField("extractDuration", extractDuration.String()).Info("extract tarbal duration")
428434

429435
return true, nil
430436
}

0 commit comments

Comments
 (0)