Merge pull request #59661 from shyamjvs/fix-profile-gatherer

Automatic merge from submit-queue (batch tested with PRs 59424, 59672, 59313, 59661). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Disable symbol resolution by pprof in profile-gatherer

Because otherwise it is failing while trying to symbolize, due to lack of a kube-apiserver binary locally (as noted by @wojtek-t) within the job pod:

```
Local symbolization failed for kube-apiserver: open /usr/local/bin/kube-apiserver: no such file or directory
```

This does seem to still produce a graph with all named references - so it seems fine to avoid it. The [documentation](https://github.com/google/pprof/blob/master/doc/pprof.md#symbolization) says:

```
pprof can add symbol information to a profile that was collected only with address information. This is useful for profiles for compiled languages, where it may not be easy or even possible for the profile source to include function names or source coordinates.
```

So my feeling is that for golang, the function names, etc are included in the profile source.

/cc @wojtek-t @kubernetes/sig-scalability-misc 

```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2018-02-09 14:46:37 -08:00 committed by GitHub
commit 4b69418676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -63,10 +63,6 @@ func checkProfileGatheringPrerequisites() error {
}
func gatherProfileOfKind(profileBaseName, kind string) error {
// Check some prerequisites before gathering the profile.
if err := checkProfileGatheringPrerequisites(); err != nil {
return err
}
// Get the profile data over SSH.
getCommand := fmt.Sprintf("curl -s localhost:8080/debug/pprof/%s", kind)
sshResult, err := SSH(getCommand, GetMasterHost()+":22", TestContext.Provider)
@ -92,10 +88,10 @@ func gatherProfileOfKind(profileBaseName, kind string) error {
switch {
// TODO: Support other profile kinds if needed (e.g inuse_space, alloc_objects, mutex, etc)
case kind == "heap":
cmd = exec.Command("go", "tool", "pprof", "-pdf", "--alloc_space", tmpfile.Name())
cmd = exec.Command("go", "tool", "pprof", "-pdf", "-symbolize=none", "--alloc_space", tmpfile.Name())
profilePrefix = "ApiserverMemoryProfile_"
case strings.HasPrefix(kind, "profile"):
cmd = exec.Command("go", "tool", "pprof", "-pdf", tmpfile.Name())
cmd = exec.Command("go", "tool", "pprof", "-pdf", "-symbolize=none", tmpfile.Name())
profilePrefix = "ApiserverCPUProfile_"
default:
return fmt.Errorf("Unknown profile kind provided: %s", kind)
@ -144,6 +140,10 @@ func GatherApiserverCPUProfileForNSeconds(wg *sync.WaitGroup, profileBaseName st
if wg != nil {
defer wg.Done()
}
if err := checkProfileGatheringPrerequisites(); err != nil {
Logf("Profile gathering pre-requisite failed: %v", err)
return
}
if profileBaseName == "" {
profileBaseName = time.Now().Format(time.RFC3339)
}
@ -156,6 +156,10 @@ func GatherApiserverMemoryProfile(wg *sync.WaitGroup, profileBaseName string) {
if wg != nil {
defer wg.Done()
}
if err := checkProfileGatheringPrerequisites(); err != nil {
Logf("Profile gathering pre-requisite failed: %v", err)
return
}
if profileBaseName == "" {
profileBaseName = time.Now().Format(time.RFC3339)
}