Skip to content

bugtool: add mode to retrieve pprof traces #10666

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

Merged
merged 2 commits into from
Mar 24, 2020
Merged

bugtool: add mode to retrieve pprof traces #10666

merged 2 commits into from
Mar 24, 2020

Conversation

aanm
Copy link
Member

@aanm aanm commented Mar 23, 2020

bugtool: add mode to retrieve pprof traces

Retrieving pprof traces on a live cluster is extremely useful.
Unfortunately this requires curl, or any http client, to be installed.
Enabling this in the bugtool will make the capture of such pprof
traces effortless for the user. By simply executing the following
command in the cilium pod, the user will have an archive with the pprof
traces for 60 seconds.

$ kubectl exec -ti -n kube-system <cilium-pod> -- ./cilium-bugtool --get-pprof --pprof-trace-seconds 60
ARCHIVE at /tmp/cilium-bugtool-20200323-141313.342+0000-UTC-490106087.tar
$ kubectl cp -n kube-system <cilium-pod>:/tmp/cilium-bugtool-20200323-141313.342+0000-UTC-490106087.tar ./

Signed-off-by: André Martins andre@cilium.io

Add option to retrieve pprof traces from running cilium-agents

@aanm aanm added pending-review release-note/minor This PR changes functionality that users may find relevant to operating Cilium. area/bugtool Impacts gathering of data for debugging purposes. labels Mar 23, 2020
@aanm aanm requested a review from a team as a code owner March 23, 2020 14:24
@aanm
Copy link
Member Author

aanm commented Mar 23, 2020

test-me-please

Copy link
Member

@tklauser tklauser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit

)

func init() {
BugtoolRootCmd.Flags().BoolVar(&archive, "archive", true, "Create archive when false skips deletion of the output directory")
BugtoolRootCmd.Flags().BoolVar(&getPProf, "get-pprof", false, "When set, only gets the pprof traces from the cilium-agent binary")
BugtoolRootCmd.Flags().IntVar(&pprofPort, "pprof-port", 6060, "Port for which pprof server is exposed")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
BugtoolRootCmd.Flags().IntVar(&pprofPort, "pprof-port", 6060, "Port for which pprof server is exposed")
BugtoolRootCmd.Flags().IntVar(&pprofPort, "pprof-port", 6060, "Port on which pprof server is exposed")

@coveralls
Copy link

coveralls commented Mar 23, 2020

Coverage Status

Coverage increased (+0.007%) to 45.563% when pulling 4083b41 on pr/bugtool-fix into 28b0fba on master.

@aanm aanm requested a review from a team as a code owner March 23, 2020 15:20
@aanm
Copy link
Member Author

aanm commented Mar 23, 2020

test-me-please

@aanm aanm requested a review from tklauser March 23, 2020 15:23
aanm added 2 commits March 23, 2020 16:26
Signed-off-by: André Martins <andre@cilium.io>
Retrieving pprof traces on a live cluster is extremely useful.
Unfortunately this requires curl, or any http client, to be installed.
Enabling this in the bugtool will make the capture of such pprof
traces effortless for the user. By simply executing the following
command in the cilium pod, the user will have an archive with the pprof
traces for 60 seconds.

```
$ kubectl exec -ti -n kube-system <cilium-pod> -- ./cilium-bugtool --get-pprof --pprof-trace-seconds 60
ARCHIVE at /tmp/cilium-bugtool-20200323-141313.342+0000-UTC-490106087.tar
$ kubectl cp -n kube-system <cilium-pod>:/tmp/cilium-bugtool-20200323-141313.342+0000-UTC-490106087.tar ./
```

Signed-off-by: André Martins <andre@cilium.io>
@aanm
Copy link
Member Author

aanm commented Mar 23, 2020

test-me-please

@tklauser
Copy link
Member

Not sure about the test failure, but it looks like a flake? https://jenkins.cilium.io/job/Cilium-PR-Ginkgo-Tests-Validated/18131/

@tklauser
Copy link
Member

test-me-please

1 similar comment
@aanm
Copy link
Member Author

aanm commented Mar 24, 2020

test-me-please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bugtool Impacts gathering of data for debugging purposes. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants