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

Backport of CLI: remove redundant allocs profile from operator debug into release/1.7.x #20226

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/20219.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
cli: Collect only one heap profile per `operator debug` interval
```
23 changes: 16 additions & 7 deletions command/operator_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -1034,22 +1034,31 @@ func (c *OperatorDebugCommand) collectPprof(path, id string, client *api.Client,
}
}

// goroutine debug type 1 = legacy text format for human readable output
// goroutine debug type 1 = goroutine in pprof text format (includes a count
// for each identical stack, pprof labels)
opts.Debug = 1
c.savePprofProfile(path, "goroutine", opts, client, interval)

// goroutine debug type 2 = goroutine stacks in panic format
// goroutine debug type 2 = goroutine stacks in panic format (includes a
// stack for each goroutine, wait reason, no pprof labels)
opts.Debug = 2
c.savePprofProfile(path, "goroutine", opts, client, interval)

// Reset to pprof binary format
opts.Debug = 0

c.savePprofProfile(path, "goroutine", opts, client, interval) // Stack traces of all current goroutines
c.savePprofProfile(path, "trace", opts, client, interval) // A trace of execution of the current program
c.savePprofProfile(path, "heap", opts, client, interval) // A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.
c.savePprofProfile(path, "allocs", opts, client, interval) // A sampling of all past memory allocations
c.savePprofProfile(path, "threadcreate", opts, client, interval) // Stack traces that led to the creation of new OS threads
// Stack traces of all current goroutines, binary format for `go tool pprof`
c.savePprofProfile(path, "goroutine", opts, client, interval)

// A trace of execution of the current program
c.savePprofProfile(path, "trace", opts, client, interval)

// A sampling of memory allocations of live objects. You can specify
// the gc GET parameter to run GC before taking the heap sample.
c.savePprofProfile(path, "heap", opts, client, interval)

// Stack traces that led to the creation of new OS threads
c.savePprofProfile(path, "threadcreate", opts, client, interval)
}

// savePprofProfile retrieves a pprof profile and writes to disk
Expand Down
1 change: 0 additions & 1 deletion command/operator_debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ func TestDebug_CapturedFiles(t *testing.T) {
}

pprofFiles := []string{
"allocs_0000.prof",
"goroutine-debug1_0000.txt",
"goroutine-debug2_0000.txt",
"goroutine_0000.prof",
Expand Down
Loading