mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +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.
|
||||
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.
|
||||
ReportImagePull(pod *api.Pod, container *api.Container, err error)
|
||||
}
|
||||
|
@ -28,13 +28,6 @@ import (
|
||||
const kubeletSubsystem = "kubelet"
|
||||
|
||||
var (
|
||||
ImagePullLatency = prometheus.NewSummary(
|
||||
prometheus.SummaryOpts{
|
||||
Subsystem: kubeletSubsystem,
|
||||
Name: "image_pull_latency_microseconds",
|
||||
Help: "Image pull latency in microseconds.",
|
||||
},
|
||||
)
|
||||
ContainersPerPodCount = prometheus.NewSummary(
|
||||
prometheus.SummaryOpts{
|
||||
Subsystem: kubeletSubsystem,
|
||||
@ -73,7 +66,6 @@ var registerMetrics sync.Once
|
||||
func Register(containerCache kubecontainer.RuntimeCache) {
|
||||
// Register the metrics.
|
||||
registerMetrics.Do(func() {
|
||||
prometheus.MustRegister(ImagePullLatency)
|
||||
prometheus.MustRegister(SyncPodLatency)
|
||||
prometheus.MustRegister(DockerOperationsLatency)
|
||||
prometheus.MustRegister(SyncPodsLatency)
|
||||
|
@ -49,15 +49,15 @@ func (kr *kubeletRuntimeHooks) ShouldPullImage(pod *api.Pod, container *api.Cont
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
kr.recorder.Eventf(ref, "failed", "Failed to pull image %q: %v", container.Image, err)
|
||||
if pullError != nil {
|
||||
kr.recorder.Eventf(ref, "failed", "Failed to pull image %q: %v", container.Image, pullError)
|
||||
} else {
|
||||
kr.recorder.Eventf(ref, "pulled", "Successfully pulled image %q", container.Image)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user