Scheduler metrics: binding rate limiter saturation

This commit is contained in:
Hongchao Deng
2015-12-02 10:10:19 -08:00
parent ba80892cec
commit c4fdb7a2d0
2 changed files with 17 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ type Config struct {
Binder Binder
// Rate at which we can create pods
// If this field is nil, we don't have any rate limit.
BindPodsRateLimiter util.RateLimiter
// NextPod should be a function that blocks until the next pod
@@ -107,6 +108,12 @@ func New(c *Config) *Scheduler {
// Run begins watching and scheduling. It starts a goroutine and returns immediately.
func (s *Scheduler) Run() {
if s.config.BindPodsRateLimiter != nil {
go util.Forever(func() {
sat := s.config.BindPodsRateLimiter.Saturation()
metrics.BindingRateLimiterSaturation.Set(sat)
}, metrics.BindingSaturationReportInterval)
}
go util.Until(s.scheduleOne, 0, s.config.StopEverything)
}