Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProfileSource ¶
type ProfileSource struct {
// contains filtered or unexported fields
}
ProfileSource defines a custom source of a runtime/pprof Profile. This can either be part of a predefined or custom profile.
func NewProfileSource ¶
func NewProfileSource(name string, debug int) (*ProfileSource, error)
NewProfileSource returns a ProfileSource with a name and debug level, where the verbosity of the final stack information increases with value. Will return an error if name is an empty string.
func (*ProfileSource) Profile ¶
func (p *ProfileSource) Profile() *pprof.Profile
Profile returns a *pprof.Profile according the the name of the ProfileSource. This will first try find an existing profile, creating one if it can't be found.
type Source ¶
type Source interface {
// Write writes it's debug information into the provided writer.
Write(w io.Writer) error
}
Source is the interface that must be implemented to provide a new debug source. Each debug source's Write method will be called to write out a debug file for that source into the overall debug zip file.
func NewCPUProfileSource ¶
NewCPUProfileSource returns a Source for CPU Profiling, measured over the passed duration.
func NewHeapDumpSource ¶
func NewHeapDumpSource() Source
NewHeapDumpSource returns a Source for heapdump.
func NewHostInfoSource ¶
func NewHostInfoSource() Source
NewHostInfoSource returns a Source for host information
type ZipWriter ¶
type ZipWriter interface {
// WriteZip writes a ZIP file in the provided writer.
// The archive contains the dumps of all sources in separate files.
WriteZip(io.Writer) error
// RegisterSource adds a new source to the produced archive.
RegisterSource(string, Source) error
// HTTPHandler sends out the ZIP file as raw bytes.
HTTPHandler() http.Handler
// RegisterHandler wires the HTTPHandlerFunc with the given router.
RegisterHandler(string, *http.ServeMux) error
}
ZipWriter aggregates sources and writes them in a zip file.
func NewZipWriter ¶
func NewZipWriter(iopts instrument.Options) ZipWriter
NewZipWriter returns an instance of an ZipWriter. The passed prefix indicates the folder where to save the zip files.
func NewZipWriterWithDefaultSources ¶
func NewZipWriterWithDefaultSources(cpuProfileDuration time.Duration, iopts instrument.Options) (ZipWriter, error)
NewZipWriterWithDefaultSources returns a zipWriter with the following debug sources already registered: CPU, heap, host, goroutines.