-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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 flag to set custom buckets for prometheus histogram #7171
Conversation
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. |
Welcome @serge-r! |
Hi @serge-r. 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 Once the patch is verified, the new status will be reflected by the 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. |
/check-cla |
cmd/nginx/flags.go
Outdated
"flag" | ||
"fmt" | ||
"github.com/spf13/pflag" |
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.
It would be better to keep 3rd party modules after the standard ones.
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.
Thank you. Fixed
@@ -98,9 +100,11 @@ var ( | |||
// updating the library to latest version changed the output of the metrics | |||
var defObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001} | |||
|
|||
//var defBuckets = []float64{0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5, 2.0, 10.0} |
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 think we can remove this? If we no longer use it.
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.
Fixed too
/assign @ElvinEfendi |
@tokers @ElvinEfendi @rikatz Hello guys, any updates? |
@serge-r reminder. PR needs a rebase |
deb749f
to
660dbb7
Compare
660dbb7
to
4ec91b8
Compare
/assign @kd7lxl |
cmd/nginx/flags.go
Outdated
@@ -157,6 +159,7 @@ Requires the update-status parameter.`) | |||
`Enables the collection of NGINX metrics`) | |||
metricsPerHost = flags.Bool("metrics-per-host", true, | |||
`Export metrics per-host`) | |||
metricsBucketStr = flags.String("metrics-buckets", "[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5, 10]", "Set of buckets which will be used for prometheus histogram metrics") |
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.
Since this is using pflag
, the native type for this would be Float64Slice()
. DurationSlice()
might also be appropriate. This way the library handles the parsing and you won't need to unmarshal json.
cmd/nginx/flags.go
Outdated
@@ -157,6 +159,7 @@ Requires the update-status parameter.`) | |||
`Enables the collection of NGINX metrics`) | |||
metricsPerHost = flags.Bool("metrics-per-host", true, | |||
`Export metrics per-host`) | |||
metricsBucketStr = flags.String("metrics-buckets", "[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5, 10]", "Set of buckets which will be used for prometheus histogram metrics") |
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.
You might consider referencing prometheus.DefBuckets
explicitly as the default instead of duplicating it.
@serge-r any update on the comments for this review? |
Hello. Thank you for review and sorry for delay. I will check and fix on next week. |
@kd7lxl: changing LGTM is restricted to collaborators In response to this:
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. |
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.
/ok-to-test
29526d4
to
17025a3
Compare
/assign |
@kd7lxl you will need to rebase in order to get the sec issues fixed :) |
ups sorry I meant @serge-r |
Hi, First of all, sorry for the long delay. It has been busy days, and I completely missed this PR. Next time you need my attention, please feel free to ping me in Slack. I'll approve this, but you need to rebase over main again (sorry...) so the gosec issue is gone. This was a local bug here :/ /approve Thanks! |
17025a3
to
5164275
Compare
/lgtm |
/hold cancel |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kd7lxl, rikatz, serge-r 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 |
Thank you so much for impementing this @iamNoah1 🙌 |
This PR adding a support for custom sets of prometheus histogram bucket.
What this PR does / why we need it:
It can also resolve issue #3898. Sometimes we needs to compare ingress requests\responses metrics with other applications metrics and need to set up same buckets sets.
Types of changes
Which issue/s this PR fixes
fixes ##3898
How Has This Been Tested?
I have add function to test flags. Also I have tests into default kind environment (make dev-env) and just change nginx-ingress-controller start flags by adding
- --metrics-buckets=[0.05, 0.1, 0.2, 0.3, 0.5, 1.0, 5, 10]
Also I have add test ingress object into dev-env make queries and get this result:
Checklist: