Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ebs br: print out the elapsed time for each snapshot size calculation #5263

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions cmd/backup-manager/app/util/backup_size.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ func calcBackupSize(ctx context.Context, volumes map[string]string, level string
func calculateSnapshotSize(volumeId, snapshotId string) (uint64, uint64, error) {
var snapshotSize uint64
var numApiReq uint64

start := time.Now()

klog.Infof("start to calculate snapshot size for %s, volume id %s",
snapshotId, volumeId)

ebsSession, err := util.NewEBSSession(util.CloudAPIConcurrency)
if err != nil {
klog.Errorf("new a ebs session failure.")
Expand Down Expand Up @@ -227,8 +233,10 @@ func calculateSnapshotSize(volumeId, snapshotId string) (uint64, uint64, error)
nextToken = resp.NextToken
}

klog.Infof("full snapshot size %s, num of ListSnapshotBlocks request %d, snapshot id %s, volume id %s",
humanize.Bytes(snapshotSize), numApiReq, snapshotId, volumeId)
elapsed := time.Since(start)

klog.Infof("full snapshot size %s, num of ListSnapshotBlocks request %d, snapshot id %s, volume id %s, takes %v",
humanize.Bytes(snapshotSize), numApiReq, snapshotId, volumeId, elapsed)

return snapshotSize, numApiReq, nil
}
Expand All @@ -239,6 +247,8 @@ func calculateChangedBlocksSize(volumeId, preSnapshotId, snapshotId string) (uin
var snapshotSize uint64
var numApiReq uint64

start := time.Now()

klog.Infof("start to calculate incremental snapshot size for %s, base on prev snapshot %s, volume id %s",
snapshotId, preSnapshotId, volumeId)

Expand Down Expand Up @@ -277,8 +287,11 @@ func calculateChangedBlocksSize(volumeId, preSnapshotId, snapshotId string) (uin
nextToken = resp.NextToken
}

klog.Infof("incremental snapshot size %s, num of api ListChangedBlocks request %d, snapshot id %s, volume id %s",
humanize.Bytes(snapshotSize), numApiReq, snapshotId, volumeId)
elapsed := time.Since(start)

klog.Infof("incremental snapshot size %s, num of api ListChangedBlocks request %d, snapshot id %s, volume id %s, takes %v",
humanize.Bytes(snapshotSize), numApiReq, snapshotId, volumeId, elapsed)

return snapshotSize, numApiReq, nil
}

Expand Down
Loading