mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Remove ImagePull metric in Kubelet.
There is an equivalent metric from our Docker metrics and this one is harder to maintain with the RuntimeHooks.
This commit is contained in:
parent
2a01a2c7e9
commit
090d0c95fa
@ -86,7 +86,7 @@ type RuntimeHooks interface {
|
|||||||
// Determines whether the runtime should pull the specified container's image.
|
// Determines whether the runtime should pull the specified container's image.
|
||||||
ShouldPullImage(pod *api.Pod, container *api.Container, imagePresent bool) bool
|
ShouldPullImage(pod *api.Pod, container *api.Container, imagePresent bool) bool
|
||||||
|
|
||||||
// Runs after an image is pulled reporting it's status. Error may be nil
|
// Runs after an image is pulled reporting its status. Error may be nil
|
||||||
// for a successful pull.
|
// for a successful pull.
|
||||||
ReportImagePull(pod *api.Pod, container *api.Container, err error)
|
ReportImagePull(pod *api.Pod, container *api.Container, err error)
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,6 @@ import (
|
|||||||
const kubeletSubsystem = "kubelet"
|
const kubeletSubsystem = "kubelet"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ImagePullLatency = prometheus.NewSummary(
|
|
||||||
prometheus.SummaryOpts{
|
|
||||||
Subsystem: kubeletSubsystem,
|
|
||||||
Name: "image_pull_latency_microseconds",
|
|
||||||
Help: "Image pull latency in microseconds.",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
ContainersPerPodCount = prometheus.NewSummary(
|
ContainersPerPodCount = prometheus.NewSummary(
|
||||||
prometheus.SummaryOpts{
|
prometheus.SummaryOpts{
|
||||||
Subsystem: kubeletSubsystem,
|
Subsystem: kubeletSubsystem,
|
||||||
@ -73,7 +66,6 @@ var registerMetrics sync.Once
|
|||||||
func Register(containerCache kubecontainer.RuntimeCache) {
|
func Register(containerCache kubecontainer.RuntimeCache) {
|
||||||
// Register the metrics.
|
// Register the metrics.
|
||||||
registerMetrics.Do(func() {
|
registerMetrics.Do(func() {
|
||||||
prometheus.MustRegister(ImagePullLatency)
|
|
||||||
prometheus.MustRegister(SyncPodLatency)
|
prometheus.MustRegister(SyncPodLatency)
|
||||||
prometheus.MustRegister(DockerOperationsLatency)
|
prometheus.MustRegister(DockerOperationsLatency)
|
||||||
prometheus.MustRegister(SyncPodsLatency)
|
prometheus.MustRegister(SyncPodsLatency)
|
||||||
|
@ -49,15 +49,15 @@ func (kr *kubeletRuntimeHooks) ShouldPullImage(pod *api.Pod, container *api.Cont
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kr *kubeletRuntimeHooks) ReportImagePull(pod *api.Pod, container *api.Container, err error) {
|
func (kr *kubeletRuntimeHooks) ReportImagePull(pod *api.Pod, container *api.Container, pullError error) {
|
||||||
ref, err := kubecontainer.GenerateContainerRef(pod, container)
|
ref, err := kubecontainer.GenerateContainerRef(pod, container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Couldn't make a ref to pod %v, container %v: '%v'", pod.Name, container.Name, err)
|
glog.Errorf("Couldn't make a ref to pod %q, container %q: '%v'", pod.Name, container.Name, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if pullError != nil {
|
||||||
kr.recorder.Eventf(ref, "failed", "Failed to pull image %q: %v", container.Image, err)
|
kr.recorder.Eventf(ref, "failed", "Failed to pull image %q: %v", container.Image, pullError)
|
||||||
} else {
|
} else {
|
||||||
kr.recorder.Eventf(ref, "pulled", "Successfully pulled image %q", container.Image)
|
kr.recorder.Eventf(ref, "pulled", "Successfully pulled image %q", container.Image)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user