Browse Source
trace: Fix <unknown> func name of requests rejected by max clients (#16977)
pull/16999/head
Anis Eleuch
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
0 deletions
-
cmd/handler-api.go
|
|
@ -30,6 +30,7 @@ import ( |
|
|
|
"github.com/minio/minio/internal/config/api" |
|
|
|
xioutil "github.com/minio/minio/internal/ioutil" |
|
|
|
"github.com/minio/minio/internal/logger" |
|
|
|
"github.com/minio/minio/internal/mcontext" |
|
|
|
) |
|
|
|
|
|
|
|
type apiConfig struct { |
|
|
@ -272,6 +273,10 @@ func maxClients(f http.HandlerFunc) http.HandlerFunc { |
|
|
|
|
|
|
|
globalHTTPStats.addRequestsInQueue(1) |
|
|
|
|
|
|
|
if tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt); ok { |
|
|
|
tc.FuncName = "s3.MaxClients" |
|
|
|
} |
|
|
|
|
|
|
|
deadlineTimer := time.NewTimer(deadline) |
|
|
|
defer deadlineTimer.Stop() |
|
|
|
|
|
|
@ -288,6 +293,10 @@ func maxClients(f http.HandlerFunc) http.HandlerFunc { |
|
|
|
globalHTTPStats.addRequestsInQueue(-1) |
|
|
|
return |
|
|
|
case <-r.Context().Done(): |
|
|
|
// When the client disconnects before getting the S3 handler
|
|
|
|
// status code response, set the status code to 499 so this request
|
|
|
|
// will be properly audited and traced.
|
|
|
|
w.WriteHeader(499) |
|
|
|
globalHTTPStats.addRequestsInQueue(-1) |
|
|
|
return |
|
|
|
} |
|
|
|