Register imagePullThroughput and count with MiB

Signed-off-by: Shukui Yang <yangshukui@bytedance.com>
This commit is contained in:
Shukui Yang
2023-04-07 10:12:41 +08:00
parent 988ee8ffef
commit db223271e3
4 changed files with 30 additions and 13 deletions

View File

@@ -209,8 +209,9 @@ func (c *criService) PullImage(ctx context.Context, r *runtime.PullImageRequest)
}
}
const mbToByte = 1024 * 1024
size, _ := image.Size(ctx)
imagePullingSpeed := float64(size) / time.Since(startTime).Seconds()
imagePullingSpeed := float64(size) / mbToByte / time.Since(startTime).Seconds()
imagePullThroughput.Observe(imagePullingSpeed)
log.G(ctx).Infof("Pulled image %q with image id %q, repo tag %q, repo digest %q, size %q in %s", imageRef, imageID,