Renaming: "Change" -> "Add" for consistency with underlying method

This commit is contained in:
Mike Spreitzer 2020-03-05 15:17:33 -05:00
parent 8a1b603209
commit c7b098ac6c
2 changed files with 11 additions and 11 deletions

View File

@ -460,7 +460,7 @@ func (qs *queueSet) removeTimedOutRequestsFromQueueLocked(queue *queue, fsName s
req.decision.SetLocked(decisionReject)
// get index for timed out requests
timeoutIdx = i
metrics.ChangeRequestsInQueues(qs.qCfg.Name, req.fsName, -1)
metrics.AddRequestsInQueues(qs.qCfg.Name, req.fsName, -1)
} else {
break
}
@ -505,7 +505,7 @@ func (qs *queueSet) enqueueLocked(request *request) {
}
queue.Enqueue(request)
qs.totRequestsWaiting++
metrics.ChangeRequestsInQueues(qs.qCfg.Name, request.fsName, 1)
metrics.AddRequestsInQueues(qs.qCfg.Name, request.fsName, 1)
}
// dispatchAsMuchAsPossibleLocked runs a loop, as long as there
@ -537,7 +537,7 @@ func (qs *queueSet) dispatchSansQueueLocked(ctx context.Context, fsName string,
}
req.decision.SetLocked(decisionExecute)
qs.totRequestsExecuting++
metrics.ChangeRequestsExecuting(qs.qCfg.Name, fsName, 1)
metrics.AddRequestsExecuting(qs.qCfg.Name, fsName, 1)
if klog.V(5) {
klog.Infof("QS(%s) at r=%s v=%.9fs: immediate dispatch of request %q %#+v %#+v, qs will have %d executing", qs.qCfg.Name, now.Format(nsTimeFmt), qs.virtualTime, fsName, descr1, descr2, qs.totRequestsExecuting)
}
@ -566,8 +566,8 @@ func (qs *queueSet) dispatchLocked() bool {
qs.totRequestsWaiting--
qs.totRequestsExecuting++
queue.requestsExecuting++
metrics.ChangeRequestsInQueues(qs.qCfg.Name, request.fsName, -1)
metrics.ChangeRequestsExecuting(qs.qCfg.Name, request.fsName, 1)
metrics.AddRequestsInQueues(qs.qCfg.Name, request.fsName, -1)
metrics.AddRequestsExecuting(qs.qCfg.Name, request.fsName, 1)
if klog.V(6) {
klog.Infof("QS(%s) at r=%s v=%.9fs: dispatching request %#+v %#+v from queue %d with virtual start time %.9fs, queue will have %d waiting & %d executing", qs.qCfg.Name, request.startTime.Format(nsTimeFmt), qs.virtualTime, request.descr1, request.descr2, queue.index, queue.virtualStart, len(queue.requests), queue.requestsExecuting)
}
@ -595,7 +595,7 @@ func (qs *queueSet) cancelWait(req *request) {
// remove the request
queue.requests = append(queue.requests[:i], queue.requests[i+1:]...)
qs.totRequestsWaiting--
metrics.ChangeRequestsInQueues(qs.qCfg.Name, req.fsName, -1)
metrics.AddRequestsInQueues(qs.qCfg.Name, req.fsName, -1)
break
}
}
@ -648,7 +648,7 @@ func (qs *queueSet) finishRequestAndDispatchAsMuchAsPossible(req *request) bool
// callback updates important state in the queueSet
func (qs *queueSet) finishRequestLocked(r *request) {
qs.totRequestsExecuting--
metrics.ChangeRequestsExecuting(qs.qCfg.Name, r.fsName, -1)
metrics.AddRequestsExecuting(qs.qCfg.Name, r.fsName, -1)
if r.queue == nil {
if klog.V(6) {

View File

@ -157,13 +157,13 @@ var (
}
)
// ChangeRequestsInQueues adds the given delta to the gauge of the # of requests in the queues of the specified flowSchema and priorityLevel
func ChangeRequestsInQueues(priorityLevel, flowSchema string, delta int) {
// AddRequestsInQueues adds the given delta to the gauge of the # of requests in the queues of the specified flowSchema and priorityLevel
func AddRequestsInQueues(priorityLevel, flowSchema string, delta int) {
apiserverCurrentInqueueRequests.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta))
}
// ChangeRequestsExecuting adds the given delta to the gauge of executing requests of the given flowSchema and priorityLevel
func ChangeRequestsExecuting(priorityLevel, flowSchema string, delta int) {
// AddRequestsExecuting adds the given delta to the gauge of executing requests of the given flowSchema and priorityLevel
func AddRequestsExecuting(priorityLevel, flowSchema string, delta int) {
apiserverCurrentExecutingRequests.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta))
}