Introduce apiserver_flowcontrol_current_executing_seats metric
This is a duplicate of `apiserver_flowcontrol_request_concurrency_in_use` but with a better name. Hopefully we can later remove the copy with the inferior name. Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com> Kubernetes-commit: 65e818d4ecfb7bf2a165897fb1caf29bf42f4f83
This commit is contained in:
		
							parent
							
								
									73ba48c7f9
								
							
						
					
					
						commit
						d03cf9927b
					
				|  | @ -726,7 +726,7 @@ func (qs *queueSet) dispatchSansQueueLocked(ctx context.Context, workEstimate *f | |||
| 	qs.totRequestsExecuting++ | ||||
| 	qs.totSeatsInUse += req.MaxSeats() | ||||
| 	metrics.AddRequestsExecuting(ctx, qs.qCfg.Name, fsName, 1) | ||||
| 	metrics.AddRequestConcurrencyInUse(qs.qCfg.Name, fsName, req.MaxSeats()) | ||||
| 	metrics.AddSeatConcurrencyInUse(qs.qCfg.Name, fsName, req.MaxSeats()) | ||||
| 	qs.reqsGaugePair.RequestsExecuting.Add(1) | ||||
| 	qs.execSeatsGauge.Add(float64(req.MaxSeats())) | ||||
| 	qs.seatDemandIntegrator.Set(float64(qs.totSeatsInUse + qs.totSeatsWaiting)) | ||||
|  | @ -771,7 +771,7 @@ func (qs *queueSet) dispatchLocked() bool { | |||
| 	queue.requestsExecuting++ | ||||
| 	queue.seatsInUse += request.MaxSeats() | ||||
| 	metrics.AddRequestsExecuting(request.ctx, qs.qCfg.Name, request.fsName, 1) | ||||
| 	metrics.AddRequestConcurrencyInUse(qs.qCfg.Name, request.fsName, request.MaxSeats()) | ||||
| 	metrics.AddSeatConcurrencyInUse(qs.qCfg.Name, request.fsName, request.MaxSeats()) | ||||
| 	qs.reqsGaugePair.RequestsExecuting.Add(1) | ||||
| 	qs.execSeatsGauge.Add(float64(request.MaxSeats())) | ||||
| 	qs.seatDemandIntegrator.Set(float64(qs.totSeatsInUse + qs.totSeatsWaiting)) | ||||
|  | @ -938,7 +938,7 @@ func (qs *queueSet) finishRequestLocked(r *request) { | |||
| 		defer qs.removeQueueIfEmptyLocked(r) | ||||
| 
 | ||||
| 		qs.totSeatsInUse -= r.MaxSeats() | ||||
| 		metrics.AddRequestConcurrencyInUse(qs.qCfg.Name, r.fsName, -r.MaxSeats()) | ||||
| 		metrics.AddSeatConcurrencyInUse(qs.qCfg.Name, r.fsName, -r.MaxSeats()) | ||||
| 		qs.execSeatsGauge.Add(-float64(r.MaxSeats())) | ||||
| 		qs.seatDemandIntegrator.Set(float64(qs.totSeatsInUse + qs.totSeatsWaiting)) | ||||
| 		if r.queue != nil { | ||||
|  |  | |||
|  | @ -241,12 +241,23 @@ var ( | |||
| 		}, | ||||
| 		[]string{priorityLevel, flowSchema}, | ||||
| 	) | ||||
| 	apiserverCurrentExecutingSeats = compbasemetrics.NewGaugeVec( | ||||
| 		&compbasemetrics.GaugeOpts{ | ||||
| 			Namespace:      namespace, | ||||
| 			Subsystem:      subsystem, | ||||
| 			Name:           "current_executing_seats", | ||||
| 			Help:           "Concurrency (number of seats) occupied by the currently executing (initial stage for a WATCH, any stage otherwise) requests in the API Priority and Fairness subsystem", | ||||
| 			StabilityLevel: compbasemetrics.ALPHA, | ||||
| 		}, | ||||
| 		[]string{priorityLevel, flowSchema}, | ||||
| 	) | ||||
| 	apiserverRequestConcurrencyInUse = compbasemetrics.NewGaugeVec( | ||||
| 		&compbasemetrics.GaugeOpts{ | ||||
| 			Namespace:         namespace, | ||||
| 			Subsystem:         subsystem, | ||||
| 			Name:              "request_concurrency_in_use", | ||||
| 			Help:              "Concurrency (number of seats) occupied by the currently executing (initial stage for a WATCH, any stage otherwise) requests in the API Priority and Fairness subsystem", | ||||
| 			DeprecatedVersion: "1.28.0", | ||||
| 			StabilityLevel:    compbasemetrics.ALPHA, | ||||
| 		}, | ||||
| 		[]string{priorityLevel, flowSchema}, | ||||
|  | @ -444,6 +455,7 @@ var ( | |||
| 		apiserverRequestQueueLength, | ||||
| 		apiserverRequestConcurrencyLimit, | ||||
| 		apiserverRequestConcurrencyInUse, | ||||
| 		apiserverCurrentExecutingSeats, | ||||
| 		apiserverCurrentExecutingRequests, | ||||
| 		apiserverRequestWaitingSeconds, | ||||
| 		apiserverRequestExecutionSeconds, | ||||
|  | @ -523,9 +535,10 @@ func SetDispatchMetrics(priorityLevel string, r, s, sMin, sMax, discountedSMin, | |||
| 	apiserverNextDiscountedSBounds.WithLabelValues(priorityLevel, "max").Set(discountedSMax) | ||||
| } | ||||
| 
 | ||||
| // AddRequestConcurrencyInUse adds the given delta to the gauge of concurrency in use by
 | ||||
| // AddSeatConcurrencyInUse adds the given delta to the gauge of seats in use by
 | ||||
| // the currently executing requests of the given flowSchema and priorityLevel
 | ||||
| func AddRequestConcurrencyInUse(priorityLevel, flowSchema string, delta int) { | ||||
| func AddSeatConcurrencyInUse(priorityLevel, flowSchema string, delta int) { | ||||
| 	apiserverCurrentExecutingSeats.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta)) | ||||
| 	apiserverRequestConcurrencyInUse.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta)) | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue