✨ Add admission response status code metrics for webhooks#3534
✨ Add admission response status code metrics for webhooks#3534mattsu2020 wants to merge 5 commits into
Conversation
|
Hi @mattsu2020. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mattsu2020 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-contributor-experience at kubernetes/community. /check-cla |
What does this do, and why do we need it?
This PR adds an admission-response-level metric:
This PR intentionally does not change the HTTP response status for valid AdmissionReview responses. Kubernetes admission webhooks are expected to return HTTP 200 with an AdmissionReview body, including when an admission decision is denied.
The existing
controller_runtime_webhook_requests_total{code=...}metric continues to represent the HTTP transport status code observed by promhttp. The new metric separately exposesAdmissionResponse.status.code, making admission decisions and errors such as 400, 403, 429, and 500 observable without changing the existing HTTP request metric semantics.The common response series are initialized when an Admission webhook is registered directly with the webhook server or configured through
StandaloneWebhook. Responses with an unset status code follow the existingResponse.Completebehavior and are recorded as 200.Validation
go test ./pkg/webhook/...go vet ./pkg/webhook/...Addresses the metrics aspect of #2972.