refactor: add eta to logging

This commit is contained in:
Derrick Hammer 2024-02-28 12:20:16 -05:00
parent a49da3fdfe
commit 0d0ec43125
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 1 deletions

View File

@ -451,8 +451,10 @@ func (s StorageServiceDefault) S3MultipartUpload(ctx context.Context, data io.Re
currentAverageDuration = totalUploadDuration / time.Duration(partNum) currentAverageDuration = totalUploadDuration / time.Duration(partNum)
eta := time.Duration(int(currentAverageDuration) * (totalParts - partNum))
s.logger.Debug("Completed part", zap.Int("partNum", partNum), zap.Int("totalParts", totalParts), zap.Uint64("partSize", partSize), zap.Int("readSize", readSize), zap.Int("size", int(size)), zap.Int("totalParts", totalParts), zap.Int("partNum", partNum), zap.String("key", key), zap.String("bucket", bucket), zap.Duration("durationMs", partDuration), s.logger.Debug("Completed part", zap.Int("partNum", partNum), zap.Int("totalParts", totalParts), zap.Uint64("partSize", partSize), zap.Int("readSize", readSize), zap.Int("size", int(size)), zap.Int("totalParts", totalParts), zap.Int("partNum", partNum), zap.String("key", key), zap.String("bucket", bucket), zap.Duration("durationMs", partDuration),
zap.Duration("currentAverageDurationMs", currentAverageDuration)) zap.Duration("currentAverageDurationMs", currentAverageDuration), zap.Duration("eta", eta))
} }
// Ensure parts are ordered by part number before completing the upload // Ensure parts are ordered by part number before completing the upload