Merge pull request #105829 from yuanchen8911/master
Fix and improve comments on kubelet metrics
This commit is contained in:
commit
19591a1324
@ -1522,7 +1522,7 @@ func (kl *Kubelet) syncPod(ctx context.Context, updateType kubetypes.SyncPodType
|
|||||||
defer klog.V(4).InfoS("syncPod exit", "pod", klog.KObj(pod), "podUID", pod.UID)
|
defer klog.V(4).InfoS("syncPod exit", "pod", klog.KObj(pod), "podUID", pod.UID)
|
||||||
|
|
||||||
// Latency measurements for the main workflow are relative to the
|
// Latency measurements for the main workflow are relative to the
|
||||||
// first time the pod was seen by the API server.
|
// first time the pod was seen by kubelet.
|
||||||
var firstSeenTime time.Time
|
var firstSeenTime time.Time
|
||||||
if firstSeenTimeStr, ok := pod.Annotations[kubetypes.ConfigFirstSeenAnnotationKey]; ok {
|
if firstSeenTimeStr, ok := pod.Annotations[kubetypes.ConfigFirstSeenAnnotationKey]; ok {
|
||||||
firstSeenTime = kubetypes.ConvertToTimestamp(firstSeenTimeStr).Get()
|
firstSeenTime = kubetypes.ConvertToTimestamp(firstSeenTimeStr).Get()
|
||||||
@ -1581,7 +1581,8 @@ func (kl *Kubelet) syncPod(ctx context.Context, updateType kubetypes.SyncPodType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the time it takes for the pod to become running.
|
// Record the time it takes for the pod to become running
|
||||||
|
// since kubelet first saw the pod if firstSeenTime is set.
|
||||||
existingStatus, ok := kl.statusManager.GetPodStatus(pod.UID)
|
existingStatus, ok := kl.statusManager.GetPodStatus(pod.UID)
|
||||||
if !ok || existingStatus.Phase == v1.PodPending && apiPodStatus.Phase == v1.PodRunning &&
|
if !ok || existingStatus.Phase == v1.PodPending && apiPodStatus.Phase == v1.PodRunning &&
|
||||||
!firstSeenTime.IsZero() {
|
!firstSeenTime.IsZero() {
|
||||||
|
@ -136,12 +136,13 @@ var (
|
|||||||
},
|
},
|
||||||
[]string{"operation_type"},
|
[]string{"operation_type"},
|
||||||
)
|
)
|
||||||
// PodStartDuration is a Histogram that tracks the duration (in seconds) it takes for a single pod to go from pending to running.
|
// PodStartDuration is a Histogram that tracks the duration (in seconds) it takes for a single pod to run since it's
|
||||||
|
// first time seen by kubelet.
|
||||||
PodStartDuration = metrics.NewHistogram(
|
PodStartDuration = metrics.NewHistogram(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: KubeletSubsystem,
|
Subsystem: KubeletSubsystem,
|
||||||
Name: PodStartDurationKey,
|
Name: PodStartDurationKey,
|
||||||
Help: "Duration in seconds for a single pod to go from pending to running.",
|
Help: "Duration in seconds from kubelet seeing a pod for the first time to the pod starting to run",
|
||||||
Buckets: metrics.DefBuckets,
|
Buckets: metrics.DefBuckets,
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
@ -158,12 +159,12 @@ var (
|
|||||||
},
|
},
|
||||||
[]string{"operation_type"},
|
[]string{"operation_type"},
|
||||||
)
|
)
|
||||||
// PodWorkerStartDuration is a Histogram that tracks the duration (in seconds) it takes from seeing a pod to starting a worker.
|
// PodWorkerStartDuration is a Histogram that tracks the duration (in seconds) it takes from kubelet seeing a pod to starting a worker.
|
||||||
PodWorkerStartDuration = metrics.NewHistogram(
|
PodWorkerStartDuration = metrics.NewHistogram(
|
||||||
&metrics.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Subsystem: KubeletSubsystem,
|
Subsystem: KubeletSubsystem,
|
||||||
Name: PodWorkerStartDurationKey,
|
Name: PodWorkerStartDurationKey,
|
||||||
Help: "Duration in seconds from seeing a pod to starting a worker.",
|
Help: "Duration in seconds from kubelet seeing a pod to starting a worker.",
|
||||||
Buckets: metrics.DefBuckets,
|
Buckets: metrics.DefBuckets,
|
||||||
StabilityLevel: metrics.ALPHA,
|
StabilityLevel: metrics.ALPHA,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user