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
client request metrics should be registered only once #17885
Conversation
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
1 similar comment
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
Labelling this PR as size/XS |
Yikes. |
ok to test |
GCE e2e test build/test passed for commit 0521481. |
LGTM - thanks! |
The author of this PR is not in the whitelist for merge, can one of the admins add the 'ok-to-merge' label? |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 0521481. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
@@ -48,6 +48,10 @@ import ( | |||
// are therefore not allowed to set manually. | |||
var specialParams = sets.NewString("timeout") | |||
|
|||
func init() { | |||
metrics.Register() |
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.
This is an improvement, but metrics itself should protect against double-registration IMO.
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.
@lavalamp It does protect you from this. And in the k8s metrics pkg, it has a double protection by using sync.Once. But this change makes things easier to reason about.
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.
Ah, great!
On Mon, Nov 30, 2015 at 1:02 PM, Xiang Li notifications@github.com wrote:
In pkg/client/unversioned/request.go
#17885 (comment)
:@@ -48,6 +48,10 @@ import (
// are therefore not allowed to set manually.
var specialParams = sets.NewString("timeout")+func init() {
- metrics.Register()
@lavalamp https://github.com/lavalamp It does protect you from this.
And in the k8s metrics pkg, it has a double protection by using sync.Once.
But this change makes things easier to reason about.—
Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/17885/files#r46203052.
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.
Yeah - the code before was correct - it wasn't correctness improvement.
It is just that we avoid some unnecessary checks (under lock) when creating every single request.
This is one of the contention found in density tests.
@wojtek-t @gmarek @fgrzadkowski