Merge pull request #83603 from Tabrizian/master

feat: change the `pod_preemption_victims` to Histogram
This commit is contained in:
Kubernetes Prow Robot 2019-10-11 10:53:43 -07:00 committed by GitHub
commit 54f089fa08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -195,11 +195,13 @@ var (
StabilityLevel: metrics.ALPHA,
},
)
PreemptionVictims = metrics.NewGauge(
&metrics.GaugeOpts{
PreemptionVictims = metrics.NewHistogram(
&metrics.HistogramOpts{
Subsystem: SchedulerSubsystem,
Name: "pod_preemption_victims",
Help: "Number of selected preemption victims",
// we think #victims>50 is pretty rare, therefore [50, +Inf) is considered a single bucket.
Buckets: metrics.LinearBuckets(5, 5, 10),
StabilityLevel: metrics.ALPHA,
})
PreemptionAttempts = metrics.NewCounter(

View File

@ -473,7 +473,7 @@ func (sched *Scheduler) preempt(state *framework.CycleState, fwk framework.Frame
sched.Recorder.Eventf(victim, preemptor, v1.EventTypeNormal, "Preempted", "Preempting", "Preempted by %v/%v on node %v", preemptor.Namespace, preemptor.Name, nodeName)
}
metrics.PreemptionVictims.Set(float64(len(victims)))
metrics.PreemptionVictims.Observe(float64(len(victims)))
}
// Clearing nominated pods should happen outside of "if node != nil". Node could
// be nil when a pod with nominated node name is eligible to preempt again,