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

Metrics: Add --metrics-per-undefined-host argument. #11818

Merged
merged 3 commits into from
Aug 26, 2024

Conversation

grounded042
Copy link
Contributor

What this PR does / why we need it:

This PR fixes #3844 by adding a flag, --metrics-per-undefined-host which
allows host labels on request metrics even if the host is not defined on an
ingress.

Today when a request metric comes in it will be dropped if the host label is
not a host explicitly defined on an ingress which ingress-nginx is tracking.
Even if --metrics-per-host is set to true it would drop metrics. You could
set --metrics-per-host to false, but then the host label was not included
in the metrics. The reasoning for this was due to wildcard hosts. Someone could
send many requests with different hostnames not defined on any ingress and the
cardinality of request metrics would explode due to the many hosts. This PR
gives those who accept the cardinality explosion risk a way to get metrics with
the host label included even when the host is not defined on an ingress.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • CVE Report (Scanner found CVE and adding report)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

Fixes #3844

How Has This Been Tested?

I have tested this in multiple ways:

  • smoke testing in a make dev-env kind cluster. I ran the code before
    and after my change and checked metrics to see the metrics dropped before
    and not dropped after.
  • added unit tests to the collector
  • added unit tests to the flags
  • added e2e tests

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority area/docs labels Aug 16, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @grounded042. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 16, 2024
Copy link

netlify bot commented Aug 16, 2024

Deploy Preview for kubernetes-ingress-nginx ready!

Name Link
🔨 Latest commit f872474
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/66cc8fea5704c2000873796a
😎 Deploy Preview https://deploy-preview-11818--kubernetes-ingress-nginx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Gacko
Copy link
Member

Gacko commented Aug 20, 2024

/cc @strongjz
/uncc

@k8s-ci-robot k8s-ci-robot requested review from strongjz and removed request for Gacko August 20, 2024 15:41
@strongjz
Copy link
Member

I meant to look at this Sunday. I will tonight.

@Gacko Gacko changed the title add --metrics-per-undefined-host to report metrics for hosts not defined in ingresses Metrics: Add --metrics-per-undefined-host. Aug 21, 2024
@Gacko Gacko changed the title Metrics: Add --metrics-per-undefined-host. Metrics: Add --metrics-per-undefined-host argument. Aug 21, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 24, 2024
Signed-off-by: Jon Carl <[email protected]>
Signed-off-by: Jon Carl <[email protected]>
@grounded042 grounded042 force-pushed the metrics-per-undefined-host branch from 4fd33ee to f872474 Compare August 26, 2024 14:23
@grounded042
Copy link
Contributor Author

I've rebased the branch so it's ready to merge.

@strongjz
Copy link
Member

/kind feature
/ok-to-test
/triage accepted
/priority backlog

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 26, 2024
@k8s-ci-robot k8s-ci-robot removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority labels Aug 26, 2024
@strongjz
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 26, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grounded042, strongjz

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 Aug 26, 2024
@k8s-ci-robot k8s-ci-robot merged commit 034c3cc into kubernetes:main Aug 26, 2024
27 checks passed
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 27, 2024
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/docs 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. 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.

Metrics not updated for wildcard domains
4 participants