Merge pull request #106629 from tkashem/apf-dispatch-metrics

apf: add metric to track dispatch with no accommodation
This commit is contained in:
Kubernetes Prow Robot 2022-01-20 09:57:36 -08:00 committed by GitHub
commit 33a2c50bce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -800,6 +800,7 @@ func (qs *queueSet) findDispatchQueueLocked() (*queue, *request) {
klogV.Infof("QS(%s): request %v %v seats %d cannot be dispatched from queue %d, waiting for currently executing requests to complete, %d requests are occupying %d seats and the limit is %d", klogV.Infof("QS(%s): request %v %v seats %d cannot be dispatched from queue %d, waiting for currently executing requests to complete, %d requests are occupying %d seats and the limit is %d",
qs.qCfg.Name, oldestReqFromMinQueue.descr1, oldestReqFromMinQueue.descr2, oldestReqFromMinQueue.MaxSeats(), minQueue.index, qs.totRequestsExecuting, qs.totSeatsInUse, qs.dCfg.ConcurrencyLimit) qs.qCfg.Name, oldestReqFromMinQueue.descr1, oldestReqFromMinQueue.descr2, oldestReqFromMinQueue.MaxSeats(), minQueue.index, qs.totRequestsExecuting, qs.totSeatsInUse, qs.dCfg.ConcurrencyLimit)
} }
metrics.AddDispatchWithNoAccommodation(qs.qCfg.Name, oldestReqFromMinQueue.fsName)
return nil, nil return nil, nil
} }
oldestReqFromMinQueue.removeFromQueueLocked() oldestReqFromMinQueue.removeFromQueueLocked()

View File

@ -324,6 +324,16 @@ var (
}, },
[]string{priorityLevel, flowSchema}, []string{priorityLevel, flowSchema},
) )
apiserverDispatchWithNoAccommodation = compbasemetrics.NewCounterVec(
&compbasemetrics.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "request_dispatch_no_accommodation_total",
Help: "Number of times a dispatch attempt resulted in a non accommodation due to lack of available seats",
StabilityLevel: compbasemetrics.ALPHA,
},
[]string{priorityLevel, flowSchema},
)
metrics = Registerables{ metrics = Registerables{
apiserverRejectedRequestsTotal, apiserverRejectedRequestsTotal,
@ -343,6 +353,7 @@ var (
watchCountSamples, watchCountSamples,
apiserverEpochAdvances, apiserverEpochAdvances,
apiserverWorkEstimatedSeats, apiserverWorkEstimatedSeats,
apiserverDispatchWithNoAccommodation,
}. }.
Append(PriorityLevelExecutionSeatsObserverGenerator.metrics()...). Append(PriorityLevelExecutionSeatsObserverGenerator.metrics()...).
Append(PriorityLevelConcurrencyObserverPairGenerator.metrics()...). Append(PriorityLevelConcurrencyObserverPairGenerator.metrics()...).
@ -428,3 +439,9 @@ func AddEpochAdvance(ctx context.Context, priorityLevel string, success bool) {
func ObserveWorkEstimatedSeats(priorityLevel, flowSchema string, seats int) { func ObserveWorkEstimatedSeats(priorityLevel, flowSchema string, seats int) {
apiserverWorkEstimatedSeats.WithLabelValues(priorityLevel, flowSchema).Observe(float64(seats)) apiserverWorkEstimatedSeats.WithLabelValues(priorityLevel, flowSchema).Observe(float64(seats))
} }
// AddDispatchWithNoAccommodation keeps track of number of times dispatch attempt results
// in a non accommodation due to lack of available seats.
func AddDispatchWithNoAccommodation(priorityLevel, flowSchema string) {
apiserverDispatchWithNoAccommodation.WithLabelValues(priorityLevel, flowSchema).Inc()
}