debug

package
v0.0.0-...-66c7a0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDebugServer

func NewDebugServer(opts ...ServerOpt) api.DebugServer

NewDebugServer creates a grpc server that implements the Debug service interface

func RegisterProfileMetadata

func RegisterProfileMetadata(m ProfileMetadata)

RegisterProfileMetadata registers the metadata used to describe how a profile snapshot is to be taken for a given profile name.

Types

type ProfileMetadata

type ProfileMetadata struct {
	Name                 string
	DefaultSampleRate    int
	DefaultSleepDuration time.Duration
	SetSampleRate        SetSampleRateFunc
	StartSnapshot        StartSnapshotFunc
	StopSnapshot         StopSnapshotFunc
}

ProfileMetadata allows setting metadata for how a snapshot of a profile is taken. ProfileMetadata need only be provided for a registered profile if sleeping is required, or a sample rate must be set before doing the snapshot. For non-pprof Profiles, it must be provided (see "cpu").

type ServerOpt

type ServerOpt func(*debugServer)

func WithVersionInfo

func WithVersionInfo(version, gitRef string) ServerOpt

WithVersionInfo sets the gitRef and release that will be returned by the debug version endpoint.

type SetSampleRateFunc

type SetSampleRateFunc func(rate int) int

SetSampleRateFunc sets the sample rate (in Hz). It must return the original value that will be passed to SetSampleRateFunc to reset it.

type StartSnapshotFunc

type StartSnapshotFunc func(io.Writer) error

StartSnapshotFunc starts the perf snapshot. The data must be written to the provided writer. If this function is not provided, the pprof profile with the matching name will be looked up and used to write the profile snapshot.

type StopSnapshotFunc

type StopSnapshotFunc func() error

StopSnapshotFunc is called to stop the perf snapshot if provided

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL