-
Notifications
You must be signed in to change notification settings - Fork 42k
Add go profile instrumentation to kubectl #68681
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
Conversation
|
/ok-to-test |
de65cbf to
8653e09
Compare
|
/kind feature |
8653e09 to
318da5a
Compare
|
/retest The pull-kubernetes-e2e-kops-aws failure seems like a flake. 8653e09382d6becd8a72d0bc06a47e7020008a2b is the previous commit. Hoping /retest will do the right thing. Edit: The bot edited the previous comment removing the |
apelisse
left a comment
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.
Looks good to me, it should either fail or default if no profile is specified though
pkg/kubectl/cmd/profiling.go
Outdated
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.
What's the goal of this profile? Does it do something?
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 just a map lookup to check if profileName is the name of an existing profile, validating the input parameter.
Given it prompted a question, it's definitely worth a comment, added it!
318da5a to
9b31064
Compare
|
If no profile is specified, |
|
/uncc |
Yeah, I don't think I agree. Running |
|
Ah I see what you mean, I think that's a general problem with options though :)
To achieve meaningful with Just in case the |
|
Sorry, I made a mistake ... I meant |
or maybe it's not, maybe you should have an option named "none", and make it the default? |
This commit adds two new global options to kubectl: --profile and --profile-output, writing out go profiles to disk to debug interesting and unexpected kubectl behaviour. As an example, here is how to capture a block file, eg. for how long are we blocked on I/O and where? $ kubectl get nodes --profile=mutex -v6 $ go tool pprof -png ./profile.pprof > out.png $ google-chrome out.png Fixes: kubernetes#68679
9b31064 to
5d634e7
Compare
|
Oh I like the Now, giving a Updated the code and help string with `"none"``. |
|
/lgtm Thanks! |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: apelisse, dlespiau The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thanks a lot for the review! |
|
Would it be possible to add a unit test (e.g. profile_test.go)? |
|
Thinking a bit about it, we could maybe add tests along the lines of:
|
This commit adds two new global options to kubectl: --profile and
--profile-output, writing out go profiles to disk to debug interesting and
unexpected kubectl behaviour.
As an example, here is how to capture a block file, eg. for how long are we
blocked on I/O and where?
$ kubectl get nodes --profile=block -v6
$ go tool pprof -png ./profile.pprof > out.png
$ google-chrome out.png
What this PR does / why we need it:
This instrumentation is useful to debug abnormal kubectl behaviour or do performance work.
Fixes: #68679
As an example here's a block profile for the
kubectl get nodescommand above, rebuilding its cache. The api server isn't local.