Open abursavich opened 1 month ago
Welcome @abursavich!
It looks like this is your first PR to kubernetes-sigs/prometheus-adapter 🎉. 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-sigs/prometheus-adapter 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. :smiley:
Hi @abursavich. 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 /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.
/assign /triage accepted
/ok-to-test
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: abursavich Once this PR has been reviewed and has the lgtm label, please ask for approval from dgrisonnet. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
/retest
Hey, @dgrisonnet! Please take another look. Tests are passing.
Fixes #668.
Pods from a deployment will have long names like:
The naive regexp that matches these pods is
foobar-59c8d74c75-9gv24|foobar-59c8d74c75-dhfbj|foobar-59c8d74c75-kggvk|foobar-59c8d74c75-nd8jm|foobar-59c8d74c75-nqctr|foobar-59c8d74c75-pxlnd|foobar-59c8d74c75-rnxk7|foobar-59c8d74c75-rpj7q|foobar-59c8d74c75-vl6n6|foobar-59c8d74c75-xhvp4
(len=239).A shorter regexp that factors out the shared prefixes and matches the same pods is
foobar-59c8d74c75-(9gv24|dhfbj|kggvk|n(d8jm|qctr)|pxlnd|r(nxk7|pj7q)|vl6n6|xhvp4)
(len=81).A similar set of only 5 pods achieves 59% compression. This example with 10 pods achieves 66% compression. At 20 pods it's ~71%, at 40 pods it's ~73%, at 80 pods it's ~74%, and at 200 pods it starts to converge to ~75%. The savings ultimately depend on the length of the deployment name, but even pods with short deployment names (e.g.
foobar
) still benefit because the replicaset hash (e.g.59c8d74c75
) contributes a lot of redundancy.Instead of trying to implement this transformation directly, this change lets the
regexp/syntax
package do all the heavy lifting. In some cases this doesn't result in the shortest possible string (e.g. some short prefix repetitions are more optimal than complete prefix factoring:nd8jm|nqctr
vsn(d8jm|qctr)
), but writing and maintaining a separate implementation isn't worth it to get at these crumbs.