Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
79a3eb81
Commit
79a3eb81
authored
Feb 18, 2019
by
danielqsj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename latency to duration in metrics
parent
0bfe4c26
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
57 additions
and
57 deletions
+57
-57
cgroup_manager_linux.go
pkg/kubelet/cm/cgroup_manager_linux.go
+3
-3
manager.go
pkg/kubelet/cm/devicemanager/manager.go
+1
-1
kubelet.go
pkg/kubelet/kubelet.go
+3
-3
instrumented_services.go
pkg/kubelet/kuberuntime/instrumented_services.go
+1
-1
instrumented_services_test.go
pkg/kubelet/kuberuntime/instrumented_services_test.go
+3
-3
metrics.go
pkg/kubelet/metrics/metrics.go
+34
-34
generic.go
pkg/kubelet/pleg/generic.go
+1
-1
kubelet_stats.go
test/e2e/framework/kubelet_stats.go
+5
-5
metrics_util.go
test/e2e/framework/metrics_util.go
+3
-3
density_test.go
test/e2e_node/density_test.go
+2
-2
gpu_device_plugin.go
test/e2e_node/gpu_device_plugin.go
+1
-1
No files found.
pkg/kubelet/cm/cgroup_manager_linux.go
View file @
79a3eb81
...
@@ -284,7 +284,7 @@ func (m *cgroupManagerImpl) Exists(name CgroupName) bool {
...
@@ -284,7 +284,7 @@ func (m *cgroupManagerImpl) Exists(name CgroupName) bool {
func
(
m
*
cgroupManagerImpl
)
Destroy
(
cgroupConfig
*
CgroupConfig
)
error
{
func
(
m
*
cgroupManagerImpl
)
Destroy
(
cgroupConfig
*
CgroupConfig
)
error
{
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
metrics
.
CgroupManager
Latency
.
WithLabelValues
(
"destroy"
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
CgroupManager
Duration
.
WithLabelValues
(
"destroy"
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedCgroupManagerLatency
.
WithLabelValues
(
"destroy"
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
DeprecatedCgroupManagerLatency
.
WithLabelValues
(
"destroy"
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}()
}()
...
@@ -412,7 +412,7 @@ func (m *cgroupManagerImpl) toResources(resourceConfig *ResourceConfig) *libcont
...
@@ -412,7 +412,7 @@ func (m *cgroupManagerImpl) toResources(resourceConfig *ResourceConfig) *libcont
func
(
m
*
cgroupManagerImpl
)
Update
(
cgroupConfig
*
CgroupConfig
)
error
{
func
(
m
*
cgroupManagerImpl
)
Update
(
cgroupConfig
*
CgroupConfig
)
error
{
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
metrics
.
CgroupManager
Latency
.
WithLabelValues
(
"update"
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
CgroupManager
Duration
.
WithLabelValues
(
"update"
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedCgroupManagerLatency
.
WithLabelValues
(
"update"
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
DeprecatedCgroupManagerLatency
.
WithLabelValues
(
"update"
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}()
}()
...
@@ -448,7 +448,7 @@ func (m *cgroupManagerImpl) Update(cgroupConfig *CgroupConfig) error {
...
@@ -448,7 +448,7 @@ func (m *cgroupManagerImpl) Update(cgroupConfig *CgroupConfig) error {
func
(
m
*
cgroupManagerImpl
)
Create
(
cgroupConfig
*
CgroupConfig
)
error
{
func
(
m
*
cgroupManagerImpl
)
Create
(
cgroupConfig
*
CgroupConfig
)
error
{
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
metrics
.
CgroupManager
Latency
.
WithLabelValues
(
"create"
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
CgroupManager
Duration
.
WithLabelValues
(
"create"
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedCgroupManagerLatency
.
WithLabelValues
(
"create"
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
DeprecatedCgroupManagerLatency
.
WithLabelValues
(
"create"
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}()
}()
...
...
pkg/kubelet/cm/devicemanager/manager.go
View file @
79a3eb81
...
@@ -697,7 +697,7 @@ func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Cont
...
@@ -697,7 +697,7 @@ func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Cont
// in a passed in AllocateRequest pointer, and issues a single Allocate call per pod.
// in a passed in AllocateRequest pointer, and issues a single Allocate call per pod.
klog
.
V
(
3
)
.
Infof
(
"Making allocation request for devices %v for device plugin %s"
,
devs
,
resource
)
klog
.
V
(
3
)
.
Infof
(
"Making allocation request for devices %v for device plugin %s"
,
devs
,
resource
)
resp
,
err
:=
eI
.
e
.
allocate
(
devs
)
resp
,
err
:=
eI
.
e
.
allocate
(
devs
)
metrics
.
DevicePluginAllocation
Latency
.
WithLabelValues
(
resource
)
.
Observe
(
metrics
.
SinceInSeconds
(
startRPCTime
))
metrics
.
DevicePluginAllocation
Duration
.
WithLabelValues
(
resource
)
.
Observe
(
metrics
.
SinceInSeconds
(
startRPCTime
))
metrics
.
DeprecatedDevicePluginAllocationLatency
.
WithLabelValues
(
resource
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
startRPCTime
))
metrics
.
DeprecatedDevicePluginAllocationLatency
.
WithLabelValues
(
resource
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
startRPCTime
))
if
err
!=
nil
{
if
err
!=
nil
{
// In case of allocation failure, we want to restore m.allocatedDevices
// In case of allocation failure, we want to restore m.allocatedDevices
...
...
pkg/kubelet/kubelet.go
View file @
79a3eb81
...
@@ -1500,7 +1500,7 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
...
@@ -1500,7 +1500,7 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
if
!
firstSeenTime
.
IsZero
()
{
if
!
firstSeenTime
.
IsZero
()
{
// This is the first time we are syncing the pod. Record the latency
// This is the first time we are syncing the pod. Record the latency
// since kubelet first saw the pod if firstSeenTime is set.
// since kubelet first saw the pod if firstSeenTime is set.
metrics
.
PodWorkerStart
Latency
.
Observe
(
metrics
.
SinceInSeconds
(
firstSeenTime
))
metrics
.
PodWorkerStart
Duration
.
Observe
(
metrics
.
SinceInSeconds
(
firstSeenTime
))
metrics
.
DeprecatedPodWorkerStartLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
firstSeenTime
))
metrics
.
DeprecatedPodWorkerStartLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
firstSeenTime
))
}
else
{
}
else
{
klog
.
V
(
3
)
.
Infof
(
"First seen time not recorded for pod %q"
,
pod
.
UID
)
klog
.
V
(
3
)
.
Infof
(
"First seen time not recorded for pod %q"
,
pod
.
UID
)
...
@@ -1518,7 +1518,7 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
...
@@ -1518,7 +1518,7 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
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
()
{
metrics
.
PodStart
Latency
.
Observe
(
metrics
.
SinceInSeconds
(
firstSeenTime
))
metrics
.
PodStart
Duration
.
Observe
(
metrics
.
SinceInSeconds
(
firstSeenTime
))
metrics
.
DeprecatedPodStartLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
firstSeenTime
))
metrics
.
DeprecatedPodStartLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
firstSeenTime
))
}
}
...
@@ -1998,7 +1998,7 @@ func (kl *Kubelet) dispatchWork(pod *v1.Pod, syncType kubetypes.SyncPodType, mir
...
@@ -1998,7 +1998,7 @@ func (kl *Kubelet) dispatchWork(pod *v1.Pod, syncType kubetypes.SyncPodType, mir
UpdateType
:
syncType
,
UpdateType
:
syncType
,
OnCompleteFunc
:
func
(
err
error
)
{
OnCompleteFunc
:
func
(
err
error
)
{
if
err
!=
nil
{
if
err
!=
nil
{
metrics
.
PodWorker
Latency
.
WithLabelValues
(
syncType
.
String
())
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
PodWorker
Duration
.
WithLabelValues
(
syncType
.
String
())
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedPodWorkerLatency
.
WithLabelValues
(
syncType
.
String
())
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
DeprecatedPodWorkerLatency
.
WithLabelValues
(
syncType
.
String
())
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}
}
},
},
...
...
pkg/kubelet/kuberuntime/instrumented_services.go
View file @
79a3eb81
...
@@ -50,7 +50,7 @@ func newInstrumentedImageManagerService(service internalapi.ImageManagerService)
...
@@ -50,7 +50,7 @@ func newInstrumentedImageManagerService(service internalapi.ImageManagerService)
func
recordOperation
(
operation
string
,
start
time
.
Time
)
{
func
recordOperation
(
operation
string
,
start
time
.
Time
)
{
metrics
.
RuntimeOperations
.
WithLabelValues
(
operation
)
.
Inc
()
metrics
.
RuntimeOperations
.
WithLabelValues
(
operation
)
.
Inc
()
metrics
.
DeprecatedRuntimeOperations
.
WithLabelValues
(
operation
)
.
Inc
()
metrics
.
DeprecatedRuntimeOperations
.
WithLabelValues
(
operation
)
.
Inc
()
metrics
.
RuntimeOperations
Latency
.
WithLabelValues
(
operation
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
RuntimeOperations
Duration
.
WithLabelValues
(
operation
)
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedRuntimeOperationsLatency
.
WithLabelValues
(
operation
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
DeprecatedRuntimeOperationsLatency
.
WithLabelValues
(
operation
)
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}
}
...
...
pkg/kubelet/kuberuntime/instrumented_services_test.go
View file @
79a3eb81
...
@@ -30,7 +30,7 @@ import (
...
@@ -30,7 +30,7 @@ import (
func
TestRecordOperation
(
t
*
testing
.
T
)
{
func
TestRecordOperation
(
t
*
testing
.
T
)
{
prometheus
.
MustRegister
(
metrics
.
RuntimeOperations
)
prometheus
.
MustRegister
(
metrics
.
RuntimeOperations
)
prometheus
.
MustRegister
(
metrics
.
RuntimeOperations
Latency
)
prometheus
.
MustRegister
(
metrics
.
RuntimeOperations
Duration
)
prometheus
.
MustRegister
(
metrics
.
RuntimeOperationsErrors
)
prometheus
.
MustRegister
(
metrics
.
RuntimeOperationsErrors
)
temporalServer
:=
"127.0.0.1:1234"
temporalServer
:=
"127.0.0.1:1234"
...
@@ -51,7 +51,7 @@ func TestRecordOperation(t *testing.T) {
...
@@ -51,7 +51,7 @@ func TestRecordOperation(t *testing.T) {
recordOperation
(
"create_container"
,
time
.
Now
())
recordOperation
(
"create_container"
,
time
.
Now
())
runtimeOperationsCounterExpected
:=
"kubelet_runtime_operations_total{operation_type=
\"
create_container
\"
} 1"
runtimeOperationsCounterExpected
:=
"kubelet_runtime_operations_total{operation_type=
\"
create_container
\"
} 1"
runtimeOperations
LatencyExpected
:=
"kubelet_runtime_operations_latency
_seconds_count{operation_type=
\"
create_container
\"
} 1"
runtimeOperations
DurationExpected
:=
"kubelet_runtime_operations_duration
_seconds_count{operation_type=
\"
create_container
\"
} 1"
assert
.
HTTPBodyContains
(
t
,
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
assert
.
HTTPBodyContains
(
t
,
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
mux
.
ServeHTTP
(
w
,
r
)
mux
.
ServeHTTP
(
w
,
r
)
...
@@ -59,7 +59,7 @@ func TestRecordOperation(t *testing.T) {
...
@@ -59,7 +59,7 @@ func TestRecordOperation(t *testing.T) {
assert
.
HTTPBodyContains
(
t
,
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
assert
.
HTTPBodyContains
(
t
,
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
mux
.
ServeHTTP
(
w
,
r
)
mux
.
ServeHTTP
(
w
,
r
)
}),
"GET"
,
prometheusURL
,
nil
,
runtimeOperations
Latency
Expected
)
}),
"GET"
,
prometheusURL
,
nil
,
runtimeOperations
Duration
Expected
)
}
}
func
TestInstrumentedVersion
(
t
*
testing
.
T
)
{
func
TestInstrumentedVersion
(
t
*
testing
.
T
)
{
...
...
pkg/kubelet/metrics/metrics.go
View file @
79a3eb81
...
@@ -34,11 +34,11 @@ const (
...
@@ -34,11 +34,11 @@ const (
KubeletSubsystem
=
"kubelet"
KubeletSubsystem
=
"kubelet"
NodeNameKey
=
"node_name"
NodeNameKey
=
"node_name"
NodeLabelKey
=
"node"
NodeLabelKey
=
"node"
PodWorker
LatencyKey
=
"pod_worker_latency
_seconds"
PodWorker
DurationKey
=
"pod_worker_duration
_seconds"
PodStart
LatencyKey
=
"pod_start_latency
_seconds"
PodStart
DurationKey
=
"pod_start_duration
_seconds"
CgroupManagerOperationsKey
=
"cgroup_manager_
latency
_seconds"
CgroupManagerOperationsKey
=
"cgroup_manager_
duration
_seconds"
PodWorkerStart
LatencyKey
=
"pod_worker_start_latency
_seconds"
PodWorkerStart
DurationKey
=
"pod_worker_start_duration
_seconds"
PLEGRelist
LatencyKey
=
"pleg_relist_latency
_seconds"
PLEGRelist
DurationKey
=
"pleg_relist_duration
_seconds"
PLEGDiscardEventsKey
=
"pleg_discard_events"
PLEGDiscardEventsKey
=
"pleg_discard_events"
PLEGRelistIntervalKey
=
"pleg_relist_interval_seconds"
PLEGRelistIntervalKey
=
"pleg_relist_interval_seconds"
EvictionStatsAgeKey
=
"eviction_stats_age_seconds"
EvictionStatsAgeKey
=
"eviction_stats_age_seconds"
...
@@ -57,14 +57,14 @@ const (
...
@@ -57,14 +57,14 @@ const (
VolumeStatsInodesUsedKey
=
"volume_stats_inodes_used"
VolumeStatsInodesUsedKey
=
"volume_stats_inodes_used"
// Metrics keys of remote runtime operations
// Metrics keys of remote runtime operations
RuntimeOperationsKey
=
"runtime_operations_total"
RuntimeOperationsKey
=
"runtime_operations_total"
RuntimeOperations
LatencyKey
=
"runtime_operations_latency
_seconds"
RuntimeOperations
DurationKey
=
"runtime_operations_duration
_seconds"
RuntimeOperationsErrorsKey
=
"runtime_operations_errors_total"
RuntimeOperationsErrorsKey
=
"runtime_operations_errors_total"
DeprecatedRuntimeOperationsKey
=
"runtime_operations"
DeprecatedRuntimeOperationsKey
=
"runtime_operations"
DeprecatedRuntimeOperationsLatencyKey
=
"runtime_operations_latency_microseconds"
DeprecatedRuntimeOperationsLatencyKey
=
"runtime_operations_latency_microseconds"
DeprecatedRuntimeOperationsErrorsKey
=
"runtime_operations_errors"
DeprecatedRuntimeOperationsErrorsKey
=
"runtime_operations_errors"
// Metrics keys of device plugin operations
// Metrics keys of device plugin operations
DevicePluginRegistrationCountKey
=
"device_plugin_registration_total"
DevicePluginRegistrationCountKey
=
"device_plugin_registration_total"
DevicePluginAllocation
LatencyKey
=
"device_plugin_alloc_latency
_seconds"
DevicePluginAllocation
DurationKey
=
"device_plugin_alloc_duration
_seconds"
DeprecatedDevicePluginRegistrationCountKey
=
"device_plugin_registration_count"
DeprecatedDevicePluginRegistrationCountKey
=
"device_plugin_registration_count"
DeprecatedDevicePluginAllocationLatencyKey
=
"device_plugin_alloc_latency_microseconds"
DeprecatedDevicePluginAllocationLatencyKey
=
"device_plugin_alloc_latency_microseconds"
...
@@ -101,45 +101,45 @@ var (
...
@@ -101,45 +101,45 @@ var (
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
)
)
PodWorker
Latency
=
prometheus
.
NewHistogramVec
(
PodWorker
Duration
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
PodWorker
Latency
Key
,
Name
:
PodWorker
Duration
Key
,
Help
:
"
Latency
in seconds to sync a single pod. Broken down by operation type: create, update, or sync"
,
Help
:
"
Duration
in seconds to sync a single pod. Broken down by operation type: create, update, or sync"
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
[]
string
{
"operation_type"
},
[]
string
{
"operation_type"
},
)
)
PodStart
Latency
=
prometheus
.
NewHistogram
(
PodStart
Duration
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
PodStart
Latency
Key
,
Name
:
PodStart
Duration
Key
,
Help
:
"
Latency
in seconds for a single pod to go from pending to running."
,
Help
:
"
Duration
in seconds for a single pod to go from pending to running."
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
)
)
CgroupManager
Latency
=
prometheus
.
NewHistogramVec
(
CgroupManager
Duration
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
CgroupManagerOperationsKey
,
Name
:
CgroupManagerOperationsKey
,
Help
:
"
Latency
in seconds for cgroup manager operations. Broken down by method."
,
Help
:
"
Duration
in seconds for cgroup manager operations. Broken down by method."
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
[]
string
{
"operation_type"
},
[]
string
{
"operation_type"
},
)
)
PodWorkerStart
Latency
=
prometheus
.
NewHistogram
(
PodWorkerStart
Duration
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
PodWorkerStart
Latency
Key
,
Name
:
PodWorkerStart
Duration
Key
,
Help
:
"
Latency
in seconds from seeing a pod to starting a worker."
,
Help
:
"
Duration
in seconds from seeing a pod to starting a worker."
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
)
)
PLEGRelist
Latency
=
prometheus
.
NewHistogram
(
PLEGRelist
Duration
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
PLEGRelist
Latency
Key
,
Name
:
PLEGRelist
Duration
Key
,
Help
:
"
Latency
in seconds for relisting pods in PLEG."
,
Help
:
"
Duration
in seconds for relisting pods in PLEG."
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
)
)
...
@@ -168,11 +168,11 @@ var (
...
@@ -168,11 +168,11 @@ var (
},
},
[]
string
{
"operation_type"
},
[]
string
{
"operation_type"
},
)
)
RuntimeOperations
Latency
=
prometheus
.
NewHistogramVec
(
RuntimeOperations
Duration
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
RuntimeOperations
Latency
Key
,
Name
:
RuntimeOperations
Duration
Key
,
Help
:
"
Latency
in seconds of runtime operations. Broken down by operation type."
,
Help
:
"
Duration
in seconds of runtime operations. Broken down by operation type."
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
[]
string
{
"operation_type"
},
[]
string
{
"operation_type"
},
...
@@ -202,11 +202,11 @@ var (
...
@@ -202,11 +202,11 @@ var (
},
},
[]
string
{
"resource_name"
},
[]
string
{
"resource_name"
},
)
)
DevicePluginAllocation
Latency
=
prometheus
.
NewHistogramVec
(
DevicePluginAllocation
Duration
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
KubeletSubsystem
,
Subsystem
:
KubeletSubsystem
,
Name
:
DevicePluginAllocation
Latency
Key
,
Name
:
DevicePluginAllocation
Duration
Key
,
Help
:
"
Latency
in seconds to serve a device plugin Allocation request. Broken down by resource name."
,
Help
:
"
Duration
in seconds to serve a device plugin Allocation request. Broken down by resource name."
,
Buckets
:
prometheus
.
DefBuckets
,
Buckets
:
prometheus
.
DefBuckets
,
},
},
[]
string
{
"resource_name"
},
[]
string
{
"resource_name"
},
...
@@ -363,21 +363,21 @@ func Register(containerCache kubecontainer.RuntimeCache, collectors ...prometheu
...
@@ -363,21 +363,21 @@ func Register(containerCache kubecontainer.RuntimeCache, collectors ...prometheu
// Register the metrics.
// Register the metrics.
registerMetrics
.
Do
(
func
()
{
registerMetrics
.
Do
(
func
()
{
prometheus
.
MustRegister
(
NodeName
)
prometheus
.
MustRegister
(
NodeName
)
prometheus
.
MustRegister
(
PodWorker
Latency
)
prometheus
.
MustRegister
(
PodWorker
Duration
)
prometheus
.
MustRegister
(
PodStart
Latency
)
prometheus
.
MustRegister
(
PodStart
Duration
)
prometheus
.
MustRegister
(
CgroupManager
Latency
)
prometheus
.
MustRegister
(
CgroupManager
Duration
)
prometheus
.
MustRegister
(
PodWorkerStart
Latency
)
prometheus
.
MustRegister
(
PodWorkerStart
Duration
)
prometheus
.
MustRegister
(
ContainersPerPodCount
)
prometheus
.
MustRegister
(
ContainersPerPodCount
)
prometheus
.
MustRegister
(
newPodAndContainerCollector
(
containerCache
))
prometheus
.
MustRegister
(
newPodAndContainerCollector
(
containerCache
))
prometheus
.
MustRegister
(
PLEGRelist
Latency
)
prometheus
.
MustRegister
(
PLEGRelist
Duration
)
prometheus
.
MustRegister
(
PLEGDiscardEvents
)
prometheus
.
MustRegister
(
PLEGDiscardEvents
)
prometheus
.
MustRegister
(
PLEGRelistInterval
)
prometheus
.
MustRegister
(
PLEGRelistInterval
)
prometheus
.
MustRegister
(
RuntimeOperations
)
prometheus
.
MustRegister
(
RuntimeOperations
)
prometheus
.
MustRegister
(
RuntimeOperations
Latency
)
prometheus
.
MustRegister
(
RuntimeOperations
Duration
)
prometheus
.
MustRegister
(
RuntimeOperationsErrors
)
prometheus
.
MustRegister
(
RuntimeOperationsErrors
)
prometheus
.
MustRegister
(
EvictionStatsAge
)
prometheus
.
MustRegister
(
EvictionStatsAge
)
prometheus
.
MustRegister
(
DevicePluginRegistrationCount
)
prometheus
.
MustRegister
(
DevicePluginRegistrationCount
)
prometheus
.
MustRegister
(
DevicePluginAllocation
Latency
)
prometheus
.
MustRegister
(
DevicePluginAllocation
Duration
)
prometheus
.
MustRegister
(
DeprecatedPodWorkerLatency
)
prometheus
.
MustRegister
(
DeprecatedPodWorkerLatency
)
prometheus
.
MustRegister
(
DeprecatedPodStartLatency
)
prometheus
.
MustRegister
(
DeprecatedPodStartLatency
)
prometheus
.
MustRegister
(
DeprecatedCgroupManagerLatency
)
prometheus
.
MustRegister
(
DeprecatedCgroupManagerLatency
)
...
...
pkg/kubelet/pleg/generic.go
View file @
79a3eb81
...
@@ -195,7 +195,7 @@ func (g *GenericPLEG) relist() {
...
@@ -195,7 +195,7 @@ func (g *GenericPLEG) relist() {
timestamp
:=
g
.
clock
.
Now
()
timestamp
:=
g
.
clock
.
Now
()
defer
func
()
{
defer
func
()
{
metrics
.
PLEGRelist
Latency
.
Observe
(
metrics
.
SinceInSeconds
(
timestamp
))
metrics
.
PLEGRelist
Duration
.
Observe
(
metrics
.
SinceInSeconds
(
timestamp
))
metrics
.
DeprecatedPLEGRelistLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
timestamp
))
metrics
.
DeprecatedPLEGRelistLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
timestamp
))
}()
}()
...
...
test/e2e/framework/kubelet_stats.go
View file @
79a3eb81
...
@@ -102,13 +102,13 @@ func getKubeletMetrics(c clientset.Interface, nodeName string) (metrics.KubeletM
...
@@ -102,13 +102,13 @@ func getKubeletMetrics(c clientset.Interface, nodeName string) (metrics.KubeletM
// Note that the KubeletMetrics passed in should not contain subsystem prefix.
// Note that the KubeletMetrics passed in should not contain subsystem prefix.
func
GetDefaultKubeletLatencyMetrics
(
ms
metrics
.
KubeletMetrics
)
KubeletLatencyMetrics
{
func
GetDefaultKubeletLatencyMetrics
(
ms
metrics
.
KubeletMetrics
)
KubeletLatencyMetrics
{
latencyMetricNames
:=
sets
.
NewString
(
latencyMetricNames
:=
sets
.
NewString
(
kubeletmetrics
.
PodWorker
Latency
Key
,
kubeletmetrics
.
PodWorker
Duration
Key
,
kubeletmetrics
.
PodWorkerStart
Latency
Key
,
kubeletmetrics
.
PodWorkerStart
Duration
Key
,
kubeletmetrics
.
PodStart
Latency
Key
,
kubeletmetrics
.
PodStart
Duration
Key
,
kubeletmetrics
.
CgroupManagerOperationsKey
,
kubeletmetrics
.
CgroupManagerOperationsKey
,
dockermetrics
.
DockerOperationsLatencyKey
,
dockermetrics
.
DockerOperationsLatencyKey
,
kubeletmetrics
.
PodWorkerStart
Latency
Key
,
kubeletmetrics
.
PodWorkerStart
Duration
Key
,
kubeletmetrics
.
PLEGRelist
Latency
Key
,
kubeletmetrics
.
PLEGRelist
Duration
Key
,
)
)
return
GetKubeletLatencyMetrics
(
ms
,
latencyMetricNames
)
return
GetKubeletLatencyMetrics
(
ms
,
latencyMetricNames
)
}
}
...
...
test/e2e/framework/metrics_util.go
View file @
79a3eb81
...
@@ -168,9 +168,9 @@ var InterestingKubeletMetrics = []string{
...
@@ -168,9 +168,9 @@ var InterestingKubeletMetrics = []string{
"kubelet_docker_errors"
,
"kubelet_docker_errors"
,
"kubelet_docker_operations_latency_seconds"
,
"kubelet_docker_operations_latency_seconds"
,
"kubelet_generate_pod_status_latency_microseconds"
,
"kubelet_generate_pod_status_latency_microseconds"
,
"kubelet_pod_start_
latency
_seconds"
,
"kubelet_pod_start_
duration
_seconds"
,
"kubelet_pod_worker_
latency
_seconds"
,
"kubelet_pod_worker_
duration
_seconds"
,
"kubelet_pod_worker_start_
latency
_seconds"
,
"kubelet_pod_worker_start_
duration
_seconds"
,
"kubelet_sync_pods_latency_microseconds"
,
"kubelet_sync_pods_latency_microseconds"
,
}
}
...
...
test/e2e_node/density_test.go
View file @
79a3eb81
...
@@ -459,12 +459,12 @@ func getPodStartLatency(node string) (framework.KubeletLatencyMetrics, error) {
...
@@ -459,12 +459,12 @@ func getPodStartLatency(node string) (framework.KubeletLatencyMetrics, error) {
for
_
,
samples
:=
range
ms
{
for
_
,
samples
:=
range
ms
{
for
_
,
sample
:=
range
samples
{
for
_
,
sample
:=
range
samples
{
if
sample
.
Metric
[
"__name__"
]
==
kubemetrics
.
KubeletSubsystem
+
"_"
+
kubemetrics
.
PodStart
Latency
Key
{
if
sample
.
Metric
[
"__name__"
]
==
kubemetrics
.
KubeletSubsystem
+
"_"
+
kubemetrics
.
PodStart
Duration
Key
{
quantile
,
_
:=
strconv
.
ParseFloat
(
string
(
sample
.
Metric
[
"quantile"
]),
64
)
quantile
,
_
:=
strconv
.
ParseFloat
(
string
(
sample
.
Metric
[
"quantile"
]),
64
)
latencyMetrics
=
append
(
latencyMetrics
,
latencyMetrics
=
append
(
latencyMetrics
,
framework
.
KubeletLatencyMetric
{
framework
.
KubeletLatencyMetric
{
Quantile
:
quantile
,
Quantile
:
quantile
,
Method
:
kubemetrics
.
PodStart
Latency
Key
,
Method
:
kubemetrics
.
PodStart
Duration
Key
,
Latency
:
time
.
Duration
(
int
(
sample
.
Value
))
*
time
.
Microsecond
})
Latency
:
time
.
Duration
(
int
(
sample
.
Value
))
*
time
.
Microsecond
})
}
}
}
}
...
...
test/e2e_node/gpu_device_plugin.go
View file @
79a3eb81
...
@@ -156,7 +156,7 @@ func logDevicePluginMetrics() {
...
@@ -156,7 +156,7 @@ func logDevicePluginMetrics() {
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
for
msKey
,
samples
:=
range
ms
{
for
msKey
,
samples
:=
range
ms
{
switch
msKey
{
switch
msKey
{
case
kubeletmetrics
.
KubeletSubsystem
+
"_"
+
kubeletmetrics
.
DevicePluginAllocation
Latency
Key
:
case
kubeletmetrics
.
KubeletSubsystem
+
"_"
+
kubeletmetrics
.
DevicePluginAllocation
Duration
Key
:
for
_
,
sample
:=
range
samples
{
for
_
,
sample
:=
range
samples
{
latency
:=
sample
.
Value
latency
:=
sample
.
Value
resource
:=
string
(
sample
.
Metric
[
"resource_name"
])
resource
:=
string
(
sample
.
Metric
[
"resource_name"
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment