cli: remove redundant allocs profile from operator debug (#20219)

The pprof `allocs` profile is identical to the `heap` profile, just with a
different default view. Collecting only one of the two is sufficient to view all
of `alloc_objects`, `alloc_space`, `inuse_objects`, and `inuse_space`, and
collecting only one means that both views will be of the same profile.

Also improve the docstrings on the goroutine profiles explaining what's in each
so that it's clear why we might want all of debug=0, debug=1, and debug=2.
This commit is contained in:
Tim Gross
2024-03-26 08:19:18 -04:00
committed by GitHub
parent f2965cad36
commit a50e6267d0
3 changed files with 19 additions and 8 deletions

View File

@@ -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