Merge pull request #8337 from keloyang/imagePullThroughput
Register imagePullThroughput and count with MiB
This commit is contained in:
commit
a7ceac8b63
@ -212,8 +212,9 @@ func (c *CRIImageService) PullImage(ctx context.Context, r *runtime.PullImageReq
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -24,23 +24,30 @@ import (
|
||||
var (
|
||||
imagePulls metrics.LabeledCounter
|
||||
inProgressImagePulls metrics.Gauge
|
||||
// pull duration / (image size / 1MBi)
|
||||
// image size in MB / image pull duration in seconds
|
||||
imagePullThroughput prom.Histogram
|
||||
)
|
||||
|
||||
func init() {
|
||||
const (
|
||||
namespace = "containerd"
|
||||
subsystem = "cri_sandboxed"
|
||||
)
|
||||
|
||||
// these CRI metrics record latencies for successful operations around a sandbox and container's lifecycle.
|
||||
ns := metrics.NewNamespace("containerd", "cri_sandboxed", nil)
|
||||
ns := metrics.NewNamespace(namespace, subsystem, nil)
|
||||
|
||||
imagePulls = ns.NewLabeledCounter("image_pulls", "succeeded and failed counters", "status")
|
||||
inProgressImagePulls = ns.NewGauge("in_progress_image_pulls", "in progress pulls", metrics.Total)
|
||||
imagePullThroughput = prom.NewHistogram(
|
||||
prom.HistogramOpts{
|
||||
Name: "image_pulling_throughput",
|
||||
Help: "image pull throughput",
|
||||
Buckets: prom.DefBuckets,
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Name: "image_pulling_throughput",
|
||||
Help: "image pull throughput",
|
||||
Buckets: prom.DefBuckets,
|
||||
},
|
||||
)
|
||||
|
||||
ns.Add(imagePullThroughput)
|
||||
metrics.Register(ns)
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -42,13 +42,18 @@ var (
|
||||
|
||||
imagePulls metrics.LabeledCounter
|
||||
inProgressImagePulls metrics.Gauge
|
||||
// pull duration / (image size / 1MBi)
|
||||
// image size in MB / image pull duration in seconds
|
||||
imagePullThroughput prom.Histogram
|
||||
)
|
||||
|
||||
func init() {
|
||||
const (
|
||||
namespace = "containerd"
|
||||
subsystem = "cri"
|
||||
)
|
||||
|
||||
// these CRI metrics record latencies for successful operations around a sandbox and container's lifecycle.
|
||||
ns := metrics.NewNamespace("containerd", "cri", nil)
|
||||
ns := metrics.NewNamespace(namespace, subsystem, nil)
|
||||
|
||||
sandboxListTimer = ns.NewTimer("sandbox_list", "time to list sandboxes")
|
||||
sandboxCreateNetworkTimer = ns.NewTimer("sandbox_create_network", "time to create the network for a sandbox")
|
||||
@ -72,12 +77,15 @@ func init() {
|
||||
inProgressImagePulls = ns.NewGauge("in_progress_image_pulls", "in progress pulls", metrics.Total)
|
||||
imagePullThroughput = prom.NewHistogram(
|
||||
prom.HistogramOpts{
|
||||
Name: "image_pulling_throughput",
|
||||
Help: "image pull throughput",
|
||||
Buckets: prom.DefBuckets,
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Name: "image_pulling_throughput",
|
||||
Help: "image pull throughput",
|
||||
Buckets: prom.DefBuckets,
|
||||
},
|
||||
)
|
||||
|
||||
ns.Add(imagePullThroughput)
|
||||
metrics.Register(ns)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user