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
f7b437ca
Commit
f7b437ca
authored
Feb 22, 2019
by
danielqsj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert latency in mertics name to duration
parent
9e4f8d6f
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
69 additions
and
19 deletions
+69
-19
prometheus.go
pkg/client/metrics/prometheus/prometheus.go
+15
-2
metrics.go
pkg/kubelet/dockershim/metrics/metrics.go
+1
-1
metrics.go
pkg/kubelet/dockershim/network/metrics/metrics.go
+1
-1
master.go
pkg/master/master.go
+5
-1
proxier.go
pkg/proxy/iptables/proxier.go
+1
-0
proxier.go
pkg/proxy/ipvs/proxier.go
+1
-0
metrics.go
pkg/proxy/metrics/metrics.go
+15
-2
metrics.go
pkg/proxy/winkernel/metrics.go
+1
-1
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+2
-0
metrics.go
pkg/scheduler/metrics/metrics.go
+18
-4
scheduler.go
pkg/scheduler/scheduler.go
+2
-0
prometheus.go
pkg/util/workqueue/prometheus/prometheus.go
+1
-1
metrics.go
...ing/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go
+1
-1
metrics.go
.../src/k8s.io/apiserver/pkg/storage/etcd/metrics/metrics.go
+3
-3
metrics_util.go
test/e2e/framework/metrics_util.go
+1
-1
metrics_test.go
test/integration/metrics/metrics_test.go
+1
-1
No files found.
pkg/client/metrics/prometheus/prometheus.go
View file @
f7b437ca
...
@@ -32,13 +32,23 @@ var (
...
@@ -32,13 +32,23 @@ var (
// "verb" and "url" labels. It is used for the rest client latency metrics.
// "verb" and "url" labels. It is used for the rest client latency metrics.
requestLatency
=
prometheus
.
NewHistogramVec
(
requestLatency
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Name
:
"rest_client_request_
latency
_seconds"
,
Name
:
"rest_client_request_
duration
_seconds"
,
Help
:
"Request latency in seconds. Broken down by verb and URL."
,
Help
:
"Request latency in seconds. Broken down by verb and URL."
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
10
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
10
),
},
},
[]
string
{
"verb"
,
"url"
},
[]
string
{
"verb"
,
"url"
},
)
)
// deprecatedRequestLatency is deprecated, please use requestLatency.
deprecatedRequestLatency
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
Name
:
"rest_client_request_latency_seconds"
,
Help
:
"(Deprecated) Request latency in seconds. Broken down by verb and URL."
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
10
),
},
[]
string
{
"verb"
,
"url"
},
)
requestResult
=
prometheus
.
NewCounterVec
(
requestResult
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
prometheus
.
CounterOpts
{
Name
:
"rest_client_requests_total"
,
Name
:
"rest_client_requests_total"
,
...
@@ -50,16 +60,19 @@ var (
...
@@ -50,16 +60,19 @@ var (
func
init
()
{
func
init
()
{
prometheus
.
MustRegister
(
requestLatency
)
prometheus
.
MustRegister
(
requestLatency
)
prometheus
.
MustRegister
(
deprecatedRequestLatency
)
prometheus
.
MustRegister
(
requestResult
)
prometheus
.
MustRegister
(
requestResult
)
metrics
.
Register
(
&
latencyAdapter
{
r
equestLatency
},
&
resultAdapter
{
requestResult
})
metrics
.
Register
(
&
latencyAdapter
{
m
:
requestLatency
,
dm
:
deprecatedR
equestLatency
},
&
resultAdapter
{
requestResult
})
}
}
type
latencyAdapter
struct
{
type
latencyAdapter
struct
{
m
*
prometheus
.
HistogramVec
m
*
prometheus
.
HistogramVec
dm
*
prometheus
.
HistogramVec
}
}
func
(
l
*
latencyAdapter
)
Observe
(
verb
string
,
u
url
.
URL
,
latency
time
.
Duration
)
{
func
(
l
*
latencyAdapter
)
Observe
(
verb
string
,
u
url
.
URL
,
latency
time
.
Duration
)
{
l
.
m
.
WithLabelValues
(
verb
,
u
.
String
())
.
Observe
(
latency
.
Seconds
())
l
.
m
.
WithLabelValues
(
verb
,
u
.
String
())
.
Observe
(
latency
.
Seconds
())
l
.
dm
.
WithLabelValues
(
verb
,
u
.
String
())
.
Observe
(
latency
.
Seconds
())
}
}
type
resultAdapter
struct
{
type
resultAdapter
struct
{
...
...
pkg/kubelet/dockershim/metrics/metrics.go
View file @
f7b437ca
...
@@ -27,7 +27,7 @@ const (
...
@@ -27,7 +27,7 @@ const (
// DockerOperationsKey is the key for docker operation metrics.
// DockerOperationsKey is the key for docker operation metrics.
DockerOperationsKey
=
"docker_operations_total"
DockerOperationsKey
=
"docker_operations_total"
// DockerOperationsLatencyKey is the key for the operation latency metrics.
// DockerOperationsLatencyKey is the key for the operation latency metrics.
DockerOperationsLatencyKey
=
"docker_operations_
latency
_seconds"
DockerOperationsLatencyKey
=
"docker_operations_
duration
_seconds"
// DockerOperationsErrorsKey is the key for the operation error metrics.
// DockerOperationsErrorsKey is the key for the operation error metrics.
DockerOperationsErrorsKey
=
"docker_operations_errors_total"
DockerOperationsErrorsKey
=
"docker_operations_errors_total"
// DockerOperationsTimeoutKey is the key for the operation timeout metrics.
// DockerOperationsTimeoutKey is the key for the operation timeout metrics.
...
...
pkg/kubelet/dockershim/network/metrics/metrics.go
View file @
f7b437ca
...
@@ -27,7 +27,7 @@ const (
...
@@ -27,7 +27,7 @@ const (
// NetworkPluginOperationsKey is the key for operation count metrics.
// NetworkPluginOperationsKey is the key for operation count metrics.
NetworkPluginOperationsKey
=
"network_plugin_operations"
NetworkPluginOperationsKey
=
"network_plugin_operations"
// NetworkPluginOperationsLatencyKey is the key for the operation latency metrics.
// NetworkPluginOperationsLatencyKey is the key for the operation latency metrics.
NetworkPluginOperationsLatencyKey
=
"network_plugin_operations_
latency
_seconds"
NetworkPluginOperationsLatencyKey
=
"network_plugin_operations_
duration
_seconds"
// DeprecatedNetworkPluginOperationsLatencyKey is the deprecated key for the operation latency metrics.
// DeprecatedNetworkPluginOperationsLatencyKey is the deprecated key for the operation latency metrics.
DeprecatedNetworkPluginOperationsLatencyKey
=
"network_plugin_operations_latency_microseconds"
DeprecatedNetworkPluginOperationsLatencyKey
=
"network_plugin_operations_latency_microseconds"
...
...
pkg/master/master.go
View file @
f7b437ca
...
@@ -387,9 +387,13 @@ func (m *Master) installTunneler(nodeTunneler tunneler.Tunneler, nodeClient core
...
@@ -387,9 +387,13 @@ func (m *Master) installTunneler(nodeTunneler tunneler.Tunneler, nodeClient core
nodeTunneler
.
Run
(
nodeAddressProvider
{
nodeClient
}
.
externalAddresses
)
nodeTunneler
.
Run
(
nodeAddressProvider
{
nodeClient
}
.
externalAddresses
)
m
.
GenericAPIServer
.
AddHealthzChecks
(
healthz
.
NamedCheck
(
"SSH Tunnel Check"
,
tunneler
.
TunnelSyncHealthChecker
(
nodeTunneler
)))
m
.
GenericAPIServer
.
AddHealthzChecks
(
healthz
.
NamedCheck
(
"SSH Tunnel Check"
,
tunneler
.
TunnelSyncHealthChecker
(
nodeTunneler
)))
prometheus
.
NewGaugeFunc
(
prometheus
.
GaugeOpts
{
prometheus
.
NewGaugeFunc
(
prometheus
.
GaugeOpts
{
Name
:
"apiserver_proxy_tunnel_sync_
latency_sec
s"
,
Name
:
"apiserver_proxy_tunnel_sync_
duration_second
s"
,
Help
:
"The time since the last successful synchronization of the SSH tunnels for proxy requests."
,
Help
:
"The time since the last successful synchronization of the SSH tunnels for proxy requests."
,
},
func
()
float64
{
return
float64
(
nodeTunneler
.
SecondsSinceSync
())
})
},
func
()
float64
{
return
float64
(
nodeTunneler
.
SecondsSinceSync
())
})
prometheus
.
NewGaugeFunc
(
prometheus
.
GaugeOpts
{
Name
:
"apiserver_proxy_tunnel_sync_latency_secs"
,
Help
:
"(Deprecated) The time since the last successful synchronization of the SSH tunnels for proxy requests."
,
},
func
()
float64
{
return
float64
(
nodeTunneler
.
SecondsSinceSync
())
})
}
}
// RESTStorageProvider is a factory type for REST storage.
// RESTStorageProvider is a factory type for REST storage.
...
...
pkg/proxy/iptables/proxier.go
View file @
f7b437ca
...
@@ -1356,6 +1356,7 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -1356,6 +1356,7 @@ func (proxier *Proxier) syncProxyRules() {
for
_
,
lastChangeTriggerTime
:=
range
endpointUpdateResult
.
LastChangeTriggerTimes
{
for
_
,
lastChangeTriggerTime
:=
range
endpointUpdateResult
.
LastChangeTriggerTimes
{
latency
:=
metrics
.
SinceInSeconds
(
lastChangeTriggerTime
)
latency
:=
metrics
.
SinceInSeconds
(
lastChangeTriggerTime
)
metrics
.
NetworkProgrammingLatency
.
Observe
(
latency
)
metrics
.
NetworkProgrammingLatency
.
Observe
(
latency
)
metrics
.
DeprecatedNetworkProgrammingLatency
.
Observe
(
latency
)
klog
.
V
(
4
)
.
Infof
(
"Network programming took %f seconds"
,
latency
)
klog
.
V
(
4
)
.
Infof
(
"Network programming took %f seconds"
,
latency
)
}
}
...
...
pkg/proxy/ipvs/proxier.go
View file @
f7b437ca
...
@@ -1203,6 +1203,7 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -1203,6 +1203,7 @@ func (proxier *Proxier) syncProxyRules() {
for
_
,
lastChangeTriggerTime
:=
range
endpointUpdateResult
.
LastChangeTriggerTimes
{
for
_
,
lastChangeTriggerTime
:=
range
endpointUpdateResult
.
LastChangeTriggerTimes
{
latency
:=
metrics
.
SinceInSeconds
(
lastChangeTriggerTime
)
latency
:=
metrics
.
SinceInSeconds
(
lastChangeTriggerTime
)
metrics
.
NetworkProgrammingLatency
.
Observe
(
latency
)
metrics
.
NetworkProgrammingLatency
.
Observe
(
latency
)
metrics
.
DeprecatedNetworkProgrammingLatency
.
Observe
(
latency
)
klog
.
V
(
4
)
.
Infof
(
"Network programming took %f seconds"
,
latency
)
klog
.
V
(
4
)
.
Infof
(
"Network programming took %f seconds"
,
latency
)
}
}
...
...
pkg/proxy/metrics/metrics.go
View file @
f7b437ca
...
@@ -30,7 +30,7 @@ var (
...
@@ -30,7 +30,7 @@ var (
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Subsystem
:
kubeProxySubsystem
,
Name
:
"sync_proxy_rules_
latency
_seconds"
,
Name
:
"sync_proxy_rules_
duration
_seconds"
,
Help
:
"SyncProxyRules latency in seconds"
,
Help
:
"SyncProxyRules latency in seconds"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
},
...
@@ -56,13 +56,25 @@ var (
...
@@ -56,13 +56,25 @@ var (
NetworkProgrammingLatency
=
prometheus
.
NewHistogram
(
NetworkProgrammingLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Subsystem
:
kubeProxySubsystem
,
Name
:
"network_programming_
latency
_seconds"
,
Name
:
"network_programming_
duration
_seconds"
,
Help
:
"In Cluster Network Programming Latency in seconds"
,
Help
:
"In Cluster Network Programming Latency in seconds"
,
// TODO(mm4tt): Reevaluate buckets before 1.14 release.
// TODO(mm4tt): Reevaluate buckets before 1.14 release.
// The last bucket will be [0.001s*2^20 ~= 17min, +inf)
// The last bucket will be [0.001s*2^20 ~= 17min, +inf)
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
20
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
20
),
},
},
)
)
// DeprecatedNetworkProgrammingLatency is deprecated, please use NetworkProgrammingLatency.
DeprecatedNetworkProgrammingLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Name
:
"network_programming_latency_seconds"
,
Help
:
"(Deprecated) In Cluster Network Programming Latency in seconds"
,
// TODO(mm4tt): Reevaluate buckets before 1.14 release.
// The last bucket will be [0.001s*2^20 ~= 17min, +inf)
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
20
),
},
)
)
)
var
registerMetricsOnce
sync
.
Once
var
registerMetricsOnce
sync
.
Once
...
@@ -73,6 +85,7 @@ func RegisterMetrics() {
...
@@ -73,6 +85,7 @@ func RegisterMetrics() {
prometheus
.
MustRegister
(
SyncProxyRulesLatency
)
prometheus
.
MustRegister
(
SyncProxyRulesLatency
)
prometheus
.
MustRegister
(
DeprecatedSyncProxyRulesLatency
)
prometheus
.
MustRegister
(
DeprecatedSyncProxyRulesLatency
)
prometheus
.
MustRegister
(
NetworkProgrammingLatency
)
prometheus
.
MustRegister
(
NetworkProgrammingLatency
)
prometheus
.
MustRegister
(
DeprecatedNetworkProgrammingLatency
)
})
})
}
}
...
...
pkg/proxy/winkernel/metrics.go
View file @
f7b437ca
...
@@ -29,7 +29,7 @@ var (
...
@@ -29,7 +29,7 @@ var (
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Subsystem
:
kubeProxySubsystem
,
Name
:
"sync_proxy_rules_
latency
_seconds"
,
Name
:
"sync_proxy_rules_
duration
_seconds"
,
Help
:
"SyncProxyRules latency in seconds"
,
Help
:
"SyncProxyRules latency in seconds"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
},
...
...
pkg/scheduler/core/generic_scheduler.go
View file @
f7b437ca
...
@@ -196,6 +196,7 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
...
@@ -196,6 +196,7 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
metrics
.
SchedulingAlgorithmPredicateEvaluationDuration
.
Observe
(
metrics
.
SinceInSeconds
(
startPredicateEvalTime
))
metrics
.
SchedulingAlgorithmPredicateEvaluationDuration
.
Observe
(
metrics
.
SinceInSeconds
(
startPredicateEvalTime
))
metrics
.
DeprecatedSchedulingAlgorithmPredicateEvaluationDuration
.
Observe
(
metrics
.
SinceInMicroseconds
(
startPredicateEvalTime
))
metrics
.
DeprecatedSchedulingAlgorithmPredicateEvaluationDuration
.
Observe
(
metrics
.
SinceInMicroseconds
(
startPredicateEvalTime
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
PredicateEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
startPredicateEvalTime
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
PredicateEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
startPredicateEvalTime
))
metrics
.
DeprecatedSchedulingLatency
.
WithLabelValues
(
metrics
.
PredicateEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
startPredicateEvalTime
))
trace
.
Step
(
"Prioritizing"
)
trace
.
Step
(
"Prioritizing"
)
startPriorityEvalTime
:=
time
.
Now
()
startPriorityEvalTime
:=
time
.
Now
()
...
@@ -218,6 +219,7 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
...
@@ -218,6 +219,7 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
metrics
.
SchedulingAlgorithmPriorityEvaluationDuration
.
Observe
(
metrics
.
SinceInSeconds
(
startPriorityEvalTime
))
metrics
.
SchedulingAlgorithmPriorityEvaluationDuration
.
Observe
(
metrics
.
SinceInSeconds
(
startPriorityEvalTime
))
metrics
.
DeprecatedSchedulingAlgorithmPriorityEvaluationDuration
.
Observe
(
metrics
.
SinceInMicroseconds
(
startPriorityEvalTime
))
metrics
.
DeprecatedSchedulingAlgorithmPriorityEvaluationDuration
.
Observe
(
metrics
.
SinceInMicroseconds
(
startPriorityEvalTime
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
PriorityEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
startPriorityEvalTime
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
PriorityEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
startPriorityEvalTime
))
metrics
.
DeprecatedSchedulingLatency
.
WithLabelValues
(
metrics
.
PriorityEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
startPriorityEvalTime
))
trace
.
Step
(
"Selecting host"
)
trace
.
Step
(
"Selecting host"
)
...
...
pkg/scheduler/metrics/metrics.go
View file @
f7b437ca
...
@@ -28,7 +28,8 @@ const (
...
@@ -28,7 +28,8 @@ const (
// SchedulerSubsystem - subsystem name used by scheduler
// SchedulerSubsystem - subsystem name used by scheduler
SchedulerSubsystem
=
"scheduler"
SchedulerSubsystem
=
"scheduler"
// SchedulingLatencyName - scheduler latency metric name
// SchedulingLatencyName - scheduler latency metric name
SchedulingLatencyName
=
"scheduling_latency_seconds"
SchedulingLatencyName
=
"scheduling_duration_seconds"
DeprecatedSchedulingLatencyName
=
"scheduling_latency_seconds"
// OperationLabel - operation label name
// OperationLabel - operation label name
OperationLabel
=
"operation"
OperationLabel
=
"operation"
...
@@ -70,10 +71,21 @@ var (
...
@@ -70,10 +71,21 @@ var (
},
},
[]
string
{
OperationLabel
},
[]
string
{
OperationLabel
},
)
)
DeprecatedSchedulingLatency
=
prometheus
.
NewSummaryVec
(
prometheus
.
SummaryOpts
{
Subsystem
:
SchedulerSubsystem
,
Name
:
DeprecatedSchedulingLatencyName
,
Help
:
"(Deprecated) Scheduling latency in seconds split by sub-parts of the scheduling operation"
,
// Make the sliding window of 5h.
// TODO: The value for this should be based on some SLI definition (long term).
MaxAge
:
5
*
time
.
Hour
,
},
[]
string
{
OperationLabel
},
)
E2eSchedulingLatency
=
prometheus
.
NewHistogram
(
E2eSchedulingLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
SchedulerSubsystem
,
Subsystem
:
SchedulerSubsystem
,
Name
:
"e2e_scheduling_
latency
_seconds"
,
Name
:
"e2e_scheduling_
duration
_seconds"
,
Help
:
"E2e scheduling latency in seconds (scheduling algorithm + binding)"
,
Help
:
"E2e scheduling latency in seconds (scheduling algorithm + binding)"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
},
...
@@ -89,7 +101,7 @@ var (
...
@@ -89,7 +101,7 @@ var (
SchedulingAlgorithmLatency
=
prometheus
.
NewHistogram
(
SchedulingAlgorithmLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
SchedulerSubsystem
,
Subsystem
:
SchedulerSubsystem
,
Name
:
"scheduling_algorithm_
latency
_seconds"
,
Name
:
"scheduling_algorithm_
duration
_seconds"
,
Help
:
"Scheduling algorithm latency in seconds"
,
Help
:
"Scheduling algorithm latency in seconds"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
},
...
@@ -153,7 +165,7 @@ var (
...
@@ -153,7 +165,7 @@ var (
BindingLatency
=
prometheus
.
NewHistogram
(
BindingLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
SchedulerSubsystem
,
Subsystem
:
SchedulerSubsystem
,
Name
:
"binding_
latency
_seconds"
,
Name
:
"binding_
duration
_seconds"
,
Help
:
"Binding latency in seconds"
,
Help
:
"Binding latency in seconds"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
},
...
@@ -182,6 +194,7 @@ var (
...
@@ -182,6 +194,7 @@ var (
metricsList
=
[]
prometheus
.
Collector
{
metricsList
=
[]
prometheus
.
Collector
{
scheduleAttempts
,
scheduleAttempts
,
SchedulingLatency
,
SchedulingLatency
,
DeprecatedSchedulingLatency
,
E2eSchedulingLatency
,
E2eSchedulingLatency
,
DeprecatedE2eSchedulingLatency
,
DeprecatedE2eSchedulingLatency
,
SchedulingAlgorithmLatency
,
SchedulingAlgorithmLatency
,
...
@@ -216,6 +229,7 @@ func Register() {
...
@@ -216,6 +229,7 @@ func Register() {
// Reset resets metrics
// Reset resets metrics
func
Reset
()
{
func
Reset
()
{
SchedulingLatency
.
Reset
()
SchedulingLatency
.
Reset
()
DeprecatedSchedulingLatency
.
Reset
()
}
}
// SinceInMicroseconds gets the time since the specified start in microseconds.
// SinceInMicroseconds gets the time since the specified start in microseconds.
...
...
pkg/scheduler/scheduler.go
View file @
f7b437ca
...
@@ -427,6 +427,7 @@ func (sched *Scheduler) bind(assumed *v1.Pod, b *v1.Binding) error {
...
@@ -427,6 +427,7 @@ func (sched *Scheduler) bind(assumed *v1.Pod, b *v1.Binding) error {
metrics
.
BindingLatency
.
Observe
(
metrics
.
SinceInSeconds
(
bindingStart
))
metrics
.
BindingLatency
.
Observe
(
metrics
.
SinceInSeconds
(
bindingStart
))
metrics
.
DeprecatedBindingLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
bindingStart
))
metrics
.
DeprecatedBindingLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
bindingStart
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
Binding
)
.
Observe
(
metrics
.
SinceInSeconds
(
bindingStart
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
Binding
)
.
Observe
(
metrics
.
SinceInSeconds
(
bindingStart
))
metrics
.
DeprecatedSchedulingLatency
.
WithLabelValues
(
metrics
.
Binding
)
.
Observe
(
metrics
.
SinceInSeconds
(
bindingStart
))
sched
.
config
.
Recorder
.
Eventf
(
assumed
,
v1
.
EventTypeNormal
,
"Scheduled"
,
"Successfully assigned %v/%v to %v"
,
assumed
.
Namespace
,
assumed
.
Name
,
b
.
Target
.
Name
)
sched
.
config
.
Recorder
.
Eventf
(
assumed
,
v1
.
EventTypeNormal
,
"Scheduled"
,
"Successfully assigned %v/%v to %v"
,
assumed
.
Namespace
,
assumed
.
Name
,
b
.
Target
.
Name
)
return
nil
return
nil
}
}
...
@@ -471,6 +472,7 @@ func (sched *Scheduler) scheduleOne() {
...
@@ -471,6 +472,7 @@ func (sched *Scheduler) scheduleOne() {
metrics
.
SchedulingAlgorithmPremptionEvaluationDuration
.
Observe
(
metrics
.
SinceInSeconds
(
preemptionStartTime
))
metrics
.
SchedulingAlgorithmPremptionEvaluationDuration
.
Observe
(
metrics
.
SinceInSeconds
(
preemptionStartTime
))
metrics
.
DeprecatedSchedulingAlgorithmPremptionEvaluationDuration
.
Observe
(
metrics
.
SinceInMicroseconds
(
preemptionStartTime
))
metrics
.
DeprecatedSchedulingAlgorithmPremptionEvaluationDuration
.
Observe
(
metrics
.
SinceInMicroseconds
(
preemptionStartTime
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
PreemptionEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
preemptionStartTime
))
metrics
.
SchedulingLatency
.
WithLabelValues
(
metrics
.
PreemptionEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
preemptionStartTime
))
metrics
.
DeprecatedSchedulingLatency
.
WithLabelValues
(
metrics
.
PreemptionEvaluation
)
.
Observe
(
metrics
.
SinceInSeconds
(
preemptionStartTime
))
}
}
// Pod did not fit anywhere, so it is counted as a failure. If preemption
// Pod did not fit anywhere, so it is counted as a failure. If preemption
// succeeds, the pod should get counted as a success the next time we try to
// succeeds, the pod should get counted as a success the next time we try to
...
...
pkg/util/workqueue/prometheus/prometheus.go
View file @
f7b437ca
...
@@ -31,7 +31,7 @@ const (
...
@@ -31,7 +31,7 @@ const (
WorkQueueSubsystem
=
"workqueue"
WorkQueueSubsystem
=
"workqueue"
DepthKey
=
"depth"
DepthKey
=
"depth"
AddsKey
=
"adds_total"
AddsKey
=
"adds_total"
QueueLatencyKey
=
"queue_
latency
_seconds"
QueueLatencyKey
=
"queue_
duration
_seconds"
WorkDurationKey
=
"work_duration_seconds"
WorkDurationKey
=
"work_duration_seconds"
UnfinishedWorkKey
=
"unfinished_work_seconds"
UnfinishedWorkKey
=
"unfinished_work_seconds"
LongestRunningProcessorKey
=
"longest_running_processor_seconds"
LongestRunningProcessorKey
=
"longest_running_processor_seconds"
...
...
staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go
View file @
f7b437ca
...
@@ -70,7 +70,7 @@ var (
...
@@ -70,7 +70,7 @@ var (
)
)
requestLatencies
=
prometheus
.
NewHistogramVec
(
requestLatencies
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Name
:
"apiserver_request_
latency
_seconds"
,
Name
:
"apiserver_request_
duration
_seconds"
,
Help
:
"Response latency distribution in seconds for each verb, group, version, resource, subresource, scope and component."
,
Help
:
"Response latency distribution in seconds for each verb, group, version, resource, subresource, scope and component."
,
// This metric is used for verifying api call latencies SLO,
// This metric is used for verifying api call latencies SLO,
// as well as tracking regressions in this aspects.
// as well as tracking regressions in this aspects.
...
...
staging/src/k8s.io/apiserver/pkg/storage/etcd/metrics/metrics.go
View file @
f7b437ca
...
@@ -42,19 +42,19 @@ var (
...
@@ -42,19 +42,19 @@ var (
cacheEntryCounter
=
prometheus
.
NewCounter
(
cacheEntryCounterOpts
)
cacheEntryCounter
=
prometheus
.
NewCounter
(
cacheEntryCounterOpts
)
cacheGetLatency
=
prometheus
.
NewHistogram
(
cacheGetLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Name
:
"etcd_request_cache_get_
latency
_seconds"
,
Name
:
"etcd_request_cache_get_
duration
_seconds"
,
Help
:
"Latency in seconds of getting an object from etcd cache"
,
Help
:
"Latency in seconds of getting an object from etcd cache"
,
},
},
)
)
cacheAddLatency
=
prometheus
.
NewHistogram
(
cacheAddLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Name
:
"etcd_request_cache_add_
latency
_seconds"
,
Name
:
"etcd_request_cache_add_
duration
_seconds"
,
Help
:
"Latency in seconds of adding an object to etcd cache"
,
Help
:
"Latency in seconds of adding an object to etcd cache"
,
},
},
)
)
etcdRequestLatency
=
prometheus
.
NewHistogramVec
(
etcdRequestLatency
=
prometheus
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Name
:
"etcd_request_
latency
_seconds"
,
Name
:
"etcd_request_
duration
_seconds"
,
Help
:
"Etcd request latency in seconds for each operation and object type."
,
Help
:
"Etcd request latency in seconds for each operation and object type."
,
},
},
[]
string
{
"operation"
,
"type"
},
[]
string
{
"operation"
,
"type"
},
...
...
test/e2e/framework/metrics_util.go
View file @
f7b437ca
...
@@ -186,7 +186,7 @@ var InterestingControllerManagerMetrics = []string{
...
@@ -186,7 +186,7 @@ var InterestingControllerManagerMetrics = []string{
var
InterestingKubeletMetrics
=
[]
string
{
var
InterestingKubeletMetrics
=
[]
string
{
"kubelet_container_manager_latency_microseconds"
,
"kubelet_container_manager_latency_microseconds"
,
"kubelet_docker_errors"
,
"kubelet_docker_errors"
,
"kubelet_docker_operations_
latency
_seconds"
,
"kubelet_docker_operations_
duration
_seconds"
,
"kubelet_generate_pod_status_latency_microseconds"
,
"kubelet_generate_pod_status_latency_microseconds"
,
"kubelet_pod_start_duration_seconds"
,
"kubelet_pod_start_duration_seconds"
,
"kubelet_pod_worker_duration_seconds"
,
"kubelet_pod_worker_duration_seconds"
,
...
...
test/integration/metrics/metrics_test.go
View file @
f7b437ca
...
@@ -121,6 +121,6 @@ func TestApiserverMetrics(t *testing.T) {
...
@@ -121,6 +121,6 @@ func TestApiserverMetrics(t *testing.T) {
}
}
checkForExpectedMetrics
(
t
,
metrics
,
[]
string
{
checkForExpectedMetrics
(
t
,
metrics
,
[]
string
{
"apiserver_request_total"
,
"apiserver_request_total"
,
"apiserver_request_
latency
_seconds"
,
"apiserver_request_
duration
_seconds"
,
})
})
}
}
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