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

bugtool: add mode to retrieve pprof traces #10666

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
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.8.0 Mar 23, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.6.8 Mar 23, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.7.2 Mar 23, 2020
@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
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

@borkmann borkmann merged commit e7fb567 into master Mar 24, 2020
1.8.0 automation moved this from In progress to Merged Mar 24, 2020
@borkmann borkmann deleted the pr/bugtool-fix branch March 24, 2020 10:00
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.6 in 1.6.8 Mar 24, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.6 to Backport done to v1.6 in 1.6.8 Mar 24, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.7 in 1.7.2 Mar 30, 2020
@tklauser tklauser moved this from Backport pending to v1.7 to Backport done to v1.7 in 1.7.2 Apr 1, 2020
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
No open projects
1.6.8
Backport done to v1.6
1.7.2
Backport done to v1.7
1.8.0
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

5 participants