From 760eb7d5dea547fd1e28fb2951d0ecd61558ac79 Mon Sep 17 00:00:00 2001 From: Min Jin Date: Fri, 6 Jun 2025 17:47:40 -0700 Subject: [PATCH] fix: record authentication latency before audit filter wraps up Signed-off-by: Min Jin --- .../k8s.io/apiserver/pkg/endpoints/filters/authentication.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go index 26dd208ac4c..0c6427d5d11 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go @@ -66,9 +66,9 @@ func withAuthentication(handler http.Handler, auth authenticator.Request, failed } resp, ok, err := auth.AuthenticateRequest(req) authenticationFinish := time.Now() + genericapirequest.TrackAuthenticationLatency(req.Context(), authenticationFinish.Sub(authenticationStart)) defer func() { metrics(req.Context(), resp, ok, err, apiAuds, authenticationStart, authenticationFinish) - genericapirequest.TrackAuthenticationLatency(req.Context(), authenticationFinish.Sub(authenticationStart)) }() if err != nil || !ok { if err != nil {