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

client request metrics should be registered only once #17885

Merged
merged 1 commit into from Nov 29, 2015

Conversation

hongchaodeng
Copy link
Contributor

This is one of the contention found in density tests.
@wojtek-t @gmarek @fgrzadkowski

@k8s-bot
Copy link

k8s-bot commented Nov 27, 2015

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
@k8s-bot
Copy link

k8s-bot commented Nov 27, 2015

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.

@k8s-github-robot
Copy link

Labelling this PR as size/XS

@k8s-github-robot k8s-github-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 27, 2015
@smarterclayton
Copy link
Contributor

Yikes.

@smarterclayton
Copy link
Contributor

ok to test

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 29, 2015
@k8s-bot
Copy link

k8s-bot commented Nov 29, 2015

GCE e2e test build/test passed for commit 0521481.

@wojtek-t
Copy link
Member

LGTM - thanks!

@k8s-github-robot
Copy link

The author of this PR is not in the whitelist for merge, can one of the admins add the 'ok-to-merge' label?

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Nov 29, 2015

GCE e2e test build/test passed for commit 0521481.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Nov 29, 2015
@k8s-github-robot k8s-github-robot merged commit c1af9dc into kubernetes:master Nov 29, 2015
@@ -48,6 +48,10 @@ import (
// are therefore not allowed to set manually.
var specialParams = sets.NewString("timeout")

func init() {
metrics.Register()
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Member

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.

@hongchaodeng hongchaodeng deleted the register branch January 11, 2016 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants