Documentation ¶
Index ¶
- Constants
- type ContinuousFileProfile
- type ContinuousFileProfileOptions
- type ContinuousFileProfilePathParams
- type ProfileSource
- type Source
- type ZipWriter
- func NewPlacementAndNamespaceZipWriterWithDefaultSources(cpuProfileDuration time.Duration, clusterClient clusterclient.Client, ...) (ZipWriter, error)
- func NewZipWriter(iopts instrument.Options) ZipWriter
- func NewZipWriterWithDefaultSources(cpuProfileDuration time.Duration, iopts instrument.Options) (ZipWriter, error)
Constants ¶
const (
// ContinuousCPUProfileName is the name of continuous CPU profile.
ContinuousCPUProfileName = "cpu"
)
const (
// DebugURL is the url for the debug dump endpoint.
DebugURL = "/debug/dump"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContinuousFileProfile ¶ added in v0.15.5
type ContinuousFileProfile struct {
// contains filtered or unexported fields
}
ContinuousFileProfile is a profile that runs continously to a file using a template for a file name.
func NewContinuousFileProfile ¶ added in v0.15.5
func NewContinuousFileProfile( opts ContinuousFileProfileOptions, ) (*ContinuousFileProfile, error)
NewContinuousFileProfile returns a new continuous file profile.
func (*ContinuousFileProfile) Start ¶ added in v0.15.5
func (c *ContinuousFileProfile) Start() error
Start will start the continuous file profile.
func (*ContinuousFileProfile) Stop ¶ added in v0.15.5
func (c *ContinuousFileProfile) Stop() error
Stop will stop the continuous file profile.
type ContinuousFileProfileOptions ¶ added in v0.15.5
type ContinuousFileProfileOptions struct { FilePathTemplate string ProfileName string ProfileDuration time.Duration ProfileDebug int Conditional func() bool Interval time.Duration InstrumentOptions instrument.Options }
ContinuousFileProfileOptions is a set of continuous file profile options.
type ContinuousFileProfilePathParams ¶ added in v0.15.5
ContinuousFileProfilePathParams is the params used to construct a file path.
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, r *http.Request) 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
func NewNamespaceInfoSource ¶ added in v0.12.0
func NewNamespaceInfoSource( clusterClient clusterclient.Client, allDefaults []handleroptions.ServiceNameAndDefaults, instrumentOpts instrument.Options, ) (Source, error)
NewNamespaceInfoSource returns a Source for namespace information.
func NewPlacementInfoSource ¶ added in v0.12.0
func NewPlacementInfoSource( service handleroptions.ServiceNameAndDefaults, placementOpts placement.HandlerOptions, iopts instrument.Options, ) (Source, error)
NewPlacementInfoSource returns a Source for placement 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, *http.Request) error // RegisterSource adds a new source to the produced archive. RegisterSource(fileName string, source Source) error // HTTPHandler sends out the ZIP file as raw bytes. HTTPHandler() http.Handler // RegisterHandler wires the HTTPHandlerFunc with the given router. RegisterHandler(handlerPath string, router *http.ServeMux) error }
ZipWriter aggregates sources and writes them in a zip file.
func NewPlacementAndNamespaceZipWriterWithDefaultSources ¶ added in v0.12.0
func NewPlacementAndNamespaceZipWriterWithDefaultSources( cpuProfileDuration time.Duration, clusterClient clusterclient.Client, placementsOpts placement.HandlerOptions, services []handleroptions.ServiceNameAndDefaults, instrumentOpts instrument.Options, ) (ZipWriter, error)
NewPlacementAndNamespaceZipWriterWithDefaultSources returns a zipWriter with the following debug sources already registered: CPU, heap, host, goroutines, namespace and placement info.
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.