mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Count dropped requests except system previledged group requests.
This commit is contained in:
parent
42fe74cd2c
commit
b13e22482e
@ -160,14 +160,6 @@ func WithMaxInFlightLimit(
|
||||
handler.ServeHTTP(w, r)
|
||||
|
||||
default:
|
||||
// We need to split this data between buckets used for throttling.
|
||||
if isMutatingRequest {
|
||||
metrics.DroppedRequests.WithLabelValues(metrics.MutatingKind).Inc()
|
||||
metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.MutatingKind).Inc()
|
||||
} else {
|
||||
metrics.DroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc()
|
||||
metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc()
|
||||
}
|
||||
// at this point we're about to return a 429, BUT not all actors should be rate limited. A system:master is so powerful
|
||||
// that they should always get an answer. It's a super-admin or a loopback connection.
|
||||
if currUser, ok := apirequest.UserFrom(ctx); ok {
|
||||
@ -178,6 +170,14 @@ func WithMaxInFlightLimit(
|
||||
}
|
||||
}
|
||||
}
|
||||
// We need to split this data between buckets used for throttling.
|
||||
if isMutatingRequest {
|
||||
metrics.DroppedRequests.WithLabelValues(metrics.MutatingKind).Inc()
|
||||
metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.MutatingKind).Inc()
|
||||
} else {
|
||||
metrics.DroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc()
|
||||
metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc()
|
||||
}
|
||||
metrics.RecordRequestTermination(r, requestInfo, metrics.APIServerComponent, http.StatusTooManyRequests)
|
||||
tooManyRequests(r, w)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user