Skip to content
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

Add a new webhook request total metric and add a 1.0s bucket boundary to the webhook latency metric #103162

Conversation

rmoriar1
Copy link
Contributor

@rmoriar1 rmoriar1 commented Jun 24, 2021

What type of PR is this?

/kind feature

What this PR does / why we need it:

We have a webhook which is configured to fail open and we would like to use metrics to detect if it is working properly.

The existing admission_webhook_rejection_count metric doesn't track requests that failed open (because they are not considered rejections) and the admission_webhook_admission_duration_seconds only includes a bool indicating whether the request was rejected or not. As a result, we are unable to track the number of requests that have failed open.

This PR adds a new admission_webhook_request_total metric which includes the webhook's HTTP response as a label. This will allow us to identify requests that have failed open.

This also adds a new bucket boundary of 1.0s to the latency metric, which will enable us to get more accurate latency data from the webhook.

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Introduces a new metric: admission_webhook_request_total with the following labels: name (string) - the webhook name, type (string) - the admission type, operation (string) - the requested verb, code (int) - the HTTP status code, rejected (bool) - whether the request was rejected, namespace (string) - the namespace of the requested resource.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 24, 2021
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions 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/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 24, 2021
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Jun 24, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @rmoriar1!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @rmoriar1. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 24, 2021
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from d85a012 to 5a9ed6d Compare June 24, 2021 18:58
Copy link
Contributor

@alexcope alexcope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind

@caesarxuchao
Copy link
Member

/cc @roycaihw
/sig instrumentation
/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jun 24, 2021
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from 7e41658 to 709279c Compare June 24, 2021 20:34
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jun 24, 2021
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from 709279c to c3afa46 Compare June 24, 2021 21:01
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 24, 2021
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from c3afa46 to 83bfc00 Compare June 24, 2021 21:04
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 24, 2021
@lavalamp
Copy link
Member

lavalamp commented Jul 8, 2021

looks generally good, some suggestions though.

@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from 7fff1af to ebf40cb Compare July 9, 2021 02:20
@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jul 9, 2021
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from ebf40cb to 4b29bf3 Compare July 9, 2021 02:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jul 9, 2021
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from 4b29bf3 to 491c8c2 Compare July 9, 2021 17:13
@lavalamp
Copy link
Member

lavalamp commented Jul 9, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lavalamp, logicalhan, rmoriar1

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2021
@rmoriar1
Copy link
Contributor Author

rmoriar1 commented Jul 9, 2021

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2021
@dims
Copy link
Member

dims commented Aug 5, 2021

@rmoriar1 needs rebase

Also add a 1.0s bucket boundary to the webhook latency metric.
@rmoriar1 rmoriar1 force-pushed the rmoriar1-add-http-code-to-webhook-metric branch from 491c8c2 to 8ed1628 Compare August 5, 2021 18:45
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 5, 2021
@rmoriar1
Copy link
Contributor Author

rmoriar1 commented Aug 5, 2021

@rmoriar1 needs rebase

Done.

@rmoriar1
Copy link
Contributor Author

rmoriar1 commented Aug 5, 2021

@lavalamp Mind re-reviewing after rebase?

@lavalamp
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 13, 2021
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit d7a06ed into kubernetes:master Aug 13, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet