Adding metric for latency of SyncPods (synching all pods).

This commit is contained in:
Victor Marmol 2015-02-26 09:16:52 -08:00
parent 1444e59fc9
commit a9301b1996
2 changed files with 11 additions and 1 deletions

View File

@ -1275,6 +1275,9 @@ func (kl *Kubelet) cleanupOrphanedVolumes(pods []api.BoundPod, running []*docker
// SyncPods synchronizes the configured list of pods (desired state) with the host current state. // SyncPods synchronizes the configured list of pods (desired state) with the host current state.
func (kl *Kubelet) SyncPods(pods []api.BoundPod, podSyncTypes map[types.UID]metrics.SyncPodType, start time.Time) error { func (kl *Kubelet) SyncPods(pods []api.BoundPod, podSyncTypes map[types.UID]metrics.SyncPodType, start time.Time) error {
defer func() {
metrics.SyncPodsLatency.Observe(metrics.SinceInMicroseconds(start))
}()
glog.V(4).Infof("Desired: %#v", pods) glog.V(4).Infof("Desired: %#v", pods)
var err error var err error
desiredContainers := make(map[podContainer]empty) desiredContainers := make(map[podContainer]empty)

View File

@ -45,8 +45,14 @@ var (
}, },
[]string{"operation_type"}, []string{"operation_type"},
) )
SyncPodsLatency = prometheus.NewSummary(
prometheus.SummaryOpts{
Subsystem: kubeletSubsystem,
Name: "sync_pods_latency_microseconds",
Help: "Latency in microseconds to sync all pods.",
},
)
// TODO(vmarmol): Containers per pod // TODO(vmarmol): Containers per pod
// TODO(vmarmol): Latency of SyncPods
DockerOperationsLatency = prometheus.NewSummaryVec( DockerOperationsLatency = prometheus.NewSummaryVec(
prometheus.SummaryOpts{ prometheus.SummaryOpts{
Subsystem: kubeletSubsystem, Subsystem: kubeletSubsystem,
@ -66,6 +72,7 @@ func Register(containerCache dockertools.DockerCache) {
prometheus.MustRegister(ImagePullLatency) prometheus.MustRegister(ImagePullLatency)
prometheus.MustRegister(SyncPodLatency) prometheus.MustRegister(SyncPodLatency)
prometheus.MustRegister(DockerOperationsLatency) prometheus.MustRegister(DockerOperationsLatency)
prometheus.MustRegister(SyncPodsLatency)
prometheus.MustRegister(newPodAndContainerCollector(containerCache)) prometheus.MustRegister(newPodAndContainerCollector(containerCache))
}) })
} }