mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Scheduler metrics: binding rate limiter saturation
This commit is contained in:
parent
ba80892cec
commit
c4fdb7a2d0
@ -25,6 +25,8 @@ import (
|
|||||||
|
|
||||||
const schedulerSubsystem = "scheduler"
|
const schedulerSubsystem = "scheduler"
|
||||||
|
|
||||||
|
var BindingSaturationReportInterval = 1 * time.Second
|
||||||
|
|
||||||
var (
|
var (
|
||||||
E2eSchedulingLatency = prometheus.NewSummary(
|
E2eSchedulingLatency = prometheus.NewSummary(
|
||||||
prometheus.SummaryOpts{
|
prometheus.SummaryOpts{
|
||||||
@ -50,6 +52,13 @@ var (
|
|||||||
MaxAge: time.Hour,
|
MaxAge: time.Hour,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
BindingRateLimiterSaturation = prometheus.NewGauge(
|
||||||
|
prometheus.GaugeOpts{
|
||||||
|
Subsystem: schedulerSubsystem,
|
||||||
|
Name: "binding_ratelimiter_saturation",
|
||||||
|
Help: "Binding rateLimiter's saturation rate in percentage",
|
||||||
|
},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
var registerMetrics sync.Once
|
var registerMetrics sync.Once
|
||||||
@ -61,6 +70,7 @@ func Register() {
|
|||||||
prometheus.MustRegister(E2eSchedulingLatency)
|
prometheus.MustRegister(E2eSchedulingLatency)
|
||||||
prometheus.MustRegister(SchedulingAlgorithmLatency)
|
prometheus.MustRegister(SchedulingAlgorithmLatency)
|
||||||
prometheus.MustRegister(BindingLatency)
|
prometheus.MustRegister(BindingLatency)
|
||||||
|
prometheus.MustRegister(BindingRateLimiterSaturation)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ type Config struct {
|
|||||||
Binder Binder
|
Binder Binder
|
||||||
|
|
||||||
// Rate at which we can create pods
|
// Rate at which we can create pods
|
||||||
|
// If this field is nil, we don't have any rate limit.
|
||||||
BindPodsRateLimiter util.RateLimiter
|
BindPodsRateLimiter util.RateLimiter
|
||||||
|
|
||||||
// NextPod should be a function that blocks until the next pod
|
// 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.
|
// Run begins watching and scheduling. It starts a goroutine and returns immediately.
|
||||||
func (s *Scheduler) Run() {
|
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)
|
go util.Until(s.scheduleOne, 0, s.config.StopEverything)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user