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
823cddf5
Commit
823cddf5
authored
Jan 05, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19263 from hongchaodeng/metrics
Auto commit by PR queue bot
parents
d30f99b3
2744447d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
metrics.go
plugin/pkg/scheduler/metrics/metrics.go
+9
-9
scheduler.go
plugin/pkg/scheduler/scheduler.go
+5
-5
No files found.
plugin/pkg/scheduler/metrics/metrics.go
View file @
823cddf5
...
@@ -28,28 +28,28 @@ const schedulerSubsystem = "scheduler"
...
@@ -28,28 +28,28 @@ const schedulerSubsystem = "scheduler"
var
BindingSaturationReportInterval
=
1
*
time
.
Second
var
BindingSaturationReportInterval
=
1
*
time
.
Second
var
(
var
(
E2eSchedulingLatency
=
prometheus
.
New
Summary
(
E2eSchedulingLatency
=
prometheus
.
New
Histogram
(
prometheus
.
Summary
Opts
{
prometheus
.
Histogram
Opts
{
Subsystem
:
schedulerSubsystem
,
Subsystem
:
schedulerSubsystem
,
Name
:
"e2e_scheduling_latency_microseconds"
,
Name
:
"e2e_scheduling_latency_microseconds"
,
Help
:
"E2e scheduling latency (scheduling algorithm + binding)"
,
Help
:
"E2e scheduling latency (scheduling algorithm + binding)"
,
MaxAge
:
time
.
Hour
,
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
)
,
},
},
)
)
SchedulingAlgorithmLatency
=
prometheus
.
New
Summary
(
SchedulingAlgorithmLatency
=
prometheus
.
New
Histogram
(
prometheus
.
Summary
Opts
{
prometheus
.
Histogram
Opts
{
Subsystem
:
schedulerSubsystem
,
Subsystem
:
schedulerSubsystem
,
Name
:
"scheduling_algorithm_latency_microseconds"
,
Name
:
"scheduling_algorithm_latency_microseconds"
,
Help
:
"Scheduling algorithm latency"
,
Help
:
"Scheduling algorithm latency"
,
MaxAge
:
time
.
Hour
,
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
)
,
},
},
)
)
BindingLatency
=
prometheus
.
New
Summary
(
BindingLatency
=
prometheus
.
New
Histogram
(
prometheus
.
Summary
Opts
{
prometheus
.
Histogram
Opts
{
Subsystem
:
schedulerSubsystem
,
Subsystem
:
schedulerSubsystem
,
Name
:
"binding_latency_microseconds"
,
Name
:
"binding_latency_microseconds"
,
Help
:
"Binding latency"
,
Help
:
"Binding latency"
,
MaxAge
:
time
.
Hour
,
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
)
,
},
},
)
)
BindingRateLimiterSaturation
=
prometheus
.
NewGauge
(
BindingRateLimiterSaturation
=
prometheus
.
NewGauge
(
...
...
plugin/pkg/scheduler/scheduler.go
View file @
823cddf5
...
@@ -125,17 +125,15 @@ func (s *Scheduler) scheduleOne() {
...
@@ -125,17 +125,15 @@ func (s *Scheduler) scheduleOne() {
glog
.
V
(
3
)
.
Infof
(
"Attempting to schedule: %+v"
,
pod
)
glog
.
V
(
3
)
.
Infof
(
"Attempting to schedule: %+v"
,
pod
)
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
metrics
.
E2eSchedulingLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}()
dest
,
err
:=
s
.
config
.
Algorithm
.
Schedule
(
pod
,
s
.
config
.
NodeLister
)
dest
,
err
:=
s
.
config
.
Algorithm
.
Schedule
(
pod
,
s
.
config
.
NodeLister
)
metrics
.
SchedulingAlgorithmLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
1
)
.
Infof
(
"Failed to schedule: %+v"
,
pod
)
glog
.
V
(
1
)
.
Infof
(
"Failed to schedule: %+v"
,
pod
)
s
.
config
.
Recorder
.
Eventf
(
pod
,
api
.
EventTypeWarning
,
"FailedScheduling"
,
"%v"
,
err
)
s
.
config
.
Recorder
.
Eventf
(
pod
,
api
.
EventTypeWarning
,
"FailedScheduling"
,
"%v"
,
err
)
s
.
config
.
Error
(
pod
,
err
)
s
.
config
.
Error
(
pod
,
err
)
return
return
}
}
metrics
.
SchedulingAlgorithmLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
b
:=
&
api
.
Binding
{
b
:=
&
api
.
Binding
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
pod
.
Namespace
,
Name
:
pod
.
Name
},
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
pod
.
Namespace
,
Name
:
pod
.
Name
},
Target
:
api
.
ObjectReference
{
Target
:
api
.
ObjectReference
{
...
@@ -149,17 +147,19 @@ func (s *Scheduler) scheduleOne() {
...
@@ -149,17 +147,19 @@ func (s *Scheduler) scheduleOne() {
s
.
config
.
Modeler
.
LockedAction
(
func
()
{
s
.
config
.
Modeler
.
LockedAction
(
func
()
{
bindingStart
:=
time
.
Now
()
bindingStart
:=
time
.
Now
()
err
:=
s
.
config
.
Binder
.
Bind
(
b
)
err
:=
s
.
config
.
Binder
.
Bind
(
b
)
metrics
.
BindingLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
bindingStart
))
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
1
)
.
Infof
(
"Failed to bind pod: %+v"
,
err
)
glog
.
V
(
1
)
.
Infof
(
"Failed to bind pod: %+v"
,
err
)
s
.
config
.
Recorder
.
Eventf
(
pod
,
api
.
EventTypeNormal
,
"FailedScheduling"
,
"Binding rejected: %v"
,
err
)
s
.
config
.
Recorder
.
Eventf
(
pod
,
api
.
EventTypeNormal
,
"FailedScheduling"
,
"Binding rejected: %v"
,
err
)
s
.
config
.
Error
(
pod
,
err
)
s
.
config
.
Error
(
pod
,
err
)
return
return
}
}
metrics
.
BindingLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
bindingStart
))
s
.
config
.
Recorder
.
Eventf
(
pod
,
api
.
EventTypeNormal
,
"Scheduled"
,
"Successfully assigned %v to %v"
,
pod
.
Name
,
dest
)
s
.
config
.
Recorder
.
Eventf
(
pod
,
api
.
EventTypeNormal
,
"Scheduled"
,
"Successfully assigned %v to %v"
,
pod
.
Name
,
dest
)
// tell the model to assume that this binding took effect.
// tell the model to assume that this binding took effect.
assumed
:=
*
pod
assumed
:=
*
pod
assumed
.
Spec
.
NodeName
=
dest
assumed
.
Spec
.
NodeName
=
dest
s
.
config
.
Modeler
.
AssumePod
(
&
assumed
)
s
.
config
.
Modeler
.
AssumePod
(
&
assumed
)
})
})
metrics
.
E2eSchedulingLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
}
}
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