New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect authentication latency metric #99944
Fix incorrect authentication latency metric #99944
Conversation
/sig scalability |
staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go
Outdated
Show resolved
Hide resolved
2b00fc7
to
d0feb44
Compare
/assign @wojtek-t |
/lgtm |
I've added release note. |
/triage accepted |
@@ -47,7 +47,7 @@ func WithAuthentication(handler http.Handler, auth authenticator.Request, failed | |||
req = req.WithContext(authenticator.WithAudiences(req.Context(), apiAuds)) | |||
} | |||
resp, ok, err := auth.AuthenticateRequest(req) | |||
defer recordAuthMetrics(req.Context(), resp, ok, err, apiAuds, authenticationStart) | |||
recordAuthMetrics(req.Context(), resp, ok, err, apiAuds, authenticationStart) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold
This breaks recording of the authentication audience error case on line 60. The fact that unit tests are green mean we have a test gap that should be closed as well.
Once this is correct, I would support merge and backport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added tests. Also, this error on line 60 was not working before. When you do defer f(err)
err is evaluated at the time of defer, not later.
d0feb44
to
f8d5970
Compare
f8d5970
to
9b87464
Compare
9b87464
to
7dffc11
Compare
/lgtm fixes regression in 1.18+ that breaks the ability to determine how long the authentication phase of the request is taking |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, marseel, wojtek-t The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
@marseel , can you file the corresponding cherry-pick PRs? |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Authentication latency metric was incorrectly calculated. It took into account request duration.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: