aiprofiler

package
v1.3.19 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorUnknownProfile = errors.New("unknown profile")

Functions

This section is empty.

Types

type BlockProfileCollector

type BlockProfileCollector struct {
	// contains filtered or unexported fields
}

func (*BlockProfileCollector) Collect

func (p *BlockProfileCollector) Collect(durationSeconds int64, isSnapshot, useCache bool, targetDeltaSampleTypes []common.SampleType) (*common.ProfileData, error)

func (*BlockProfileCollector) FileName

func (p *BlockProfileCollector) FileName() string

func (*BlockProfileCollector) GetPrevious

func (p *BlockProfileCollector) GetPrevious() *profile.Profile

func (*BlockProfileCollector) Name

func (p *BlockProfileCollector) Name() string

func (*BlockProfileCollector) SetPrevious

func (p *BlockProfileCollector) SetPrevious(pre *profile.Profile)

func (*BlockProfileCollector) SupportDelta

func (p *BlockProfileCollector) SupportDelta() bool

type CPUProfileCollector

type CPUProfileCollector struct{}

func (*CPUProfileCollector) Collect

func (p *CPUProfileCollector) Collect(durationSeconds int64, _, _ bool, _ []common.SampleType) (*common.ProfileData, error)

func (*CPUProfileCollector) FileName

func (p *CPUProfileCollector) FileName() string

func (*CPUProfileCollector) GetPrevious

func (p *CPUProfileCollector) GetPrevious() *profile.Profile

func (*CPUProfileCollector) Name

func (p *CPUProfileCollector) Name() string

func (*CPUProfileCollector) SetPrevious

func (p *CPUProfileCollector) SetPrevious(*profile.Profile)

func (*CPUProfileCollector) SupportDelta

func (p *CPUProfileCollector) SupportDelta() bool

type Config

type Config struct {
	TaskChanSize int
	OutChanSize  int

	SenderCfg   sender.Config
	SettingsCfg manager.SettingAddrConfig

	// service register
	ServiceRegisterCfg service_register.Config

	Logger logger.Logger
	// contains filtered or unexported fields
}

type GoroutineProfileCollector

type GoroutineProfileCollector struct {
	// contains filtered or unexported fields
}

func (*GoroutineProfileCollector) Collect

func (p *GoroutineProfileCollector) Collect(durationSeconds int64, isSnapshot, useCache bool, targetDeltaSampleTypes []common.SampleType) (*common.ProfileData, error)

func (*GoroutineProfileCollector) FileName

func (p *GoroutineProfileCollector) FileName() string

func (*GoroutineProfileCollector) GetPrevious

func (p *GoroutineProfileCollector) GetPrevious() *profile.Profile

func (*GoroutineProfileCollector) Name

func (*GoroutineProfileCollector) SetPrevious

func (p *GoroutineProfileCollector) SetPrevious(pre *profile.Profile)

func (*GoroutineProfileCollector) SupportDelta

func (p *GoroutineProfileCollector) SupportDelta() bool

type HeapProfileCollector

type HeapProfileCollector struct {
	// contains filtered or unexported fields
}

func (*HeapProfileCollector) Collect

func (p *HeapProfileCollector) Collect(durationSeconds int64, isSnapshot, useCache bool, targetDeltaSampleTypes []common.SampleType) (*common.ProfileData, error)

func (*HeapProfileCollector) FileName

func (p *HeapProfileCollector) FileName() string

func (*HeapProfileCollector) GetPrevious

func (p *HeapProfileCollector) GetPrevious() *profile.Profile

func (*HeapProfileCollector) Name

func (p *HeapProfileCollector) Name() string

func (*HeapProfileCollector) SetPrevious

func (p *HeapProfileCollector) SetPrevious(pre *profile.Profile)

func (*HeapProfileCollector) SupportDelta

func (p *HeapProfileCollector) SupportDelta() bool

type MutexProfileCollector

type MutexProfileCollector struct {
	// contains filtered or unexported fields
}

func (*MutexProfileCollector) Collect

func (p *MutexProfileCollector) Collect(durationSeconds int64, isSnapshot, useCache bool, targetDeltaSampleTypes []common.SampleType) (*common.ProfileData, error)

func (*MutexProfileCollector) FileName

func (p *MutexProfileCollector) FileName() string

func (*MutexProfileCollector) GetPrevious

func (p *MutexProfileCollector) GetPrevious() *profile.Profile

func (*MutexProfileCollector) Name

func (p *MutexProfileCollector) Name() string

func (*MutexProfileCollector) SetPrevious

func (p *MutexProfileCollector) SetPrevious(pre *profile.Profile)

func (*MutexProfileCollector) SupportDelta

func (p *MutexProfileCollector) SupportDelta() bool

type Option

type Option func(*Config)

func WithBackoffInterval

func WithBackoffInterval(internal time.Duration) Option

WithBackoffInterval set wait interval between retries when data upload fail

func WithBlockProfile

func WithBlockProfile(rate int) Option

WithBlockProfile enables blockProfile with rate, rate's unit is nanoseconds, which means 1 blocking event per rate nanoseconds is reported. see runtime.SetBlockProfileRate BlockProfile is disabled by default. In most cases, BlockProfile has low CPU overhead. However, please be aware that BlockProfile can cause CPU overhead under certain circumstance. (Setting rate to 10,000ns may cause up to 4% CPU overhead in some scenario according to document https://github.com/DataDog/go-profiler-notes/blob/main/guide/README.md#block-profiler-limitations). For safety defaultBlockRate is set to 100,000,000ns(100ms), meaning block events with duration longer than 100ms will be recorded, while block events with duration of 1ms has a 1% chance to be recorded.

func WithBlockProfileDefault added in v1.3.6

func WithBlockProfileDefault() Option

func WithHTTPEndPoint

func WithHTTPEndPoint(schema, host string, timeout time.Duration) Option

WithHTTPEndPoint set http endpoint for both settings and profile data thus bypass server-agent, which is useful where server-agent is not installed

func WithLogger

func WithLogger(l logger.Logger) Option

WithLogger set logger used in profiler

func WithMutexProfile

func WithMutexProfile(fraction int) Option

WithMutexProfile enables mutexProfile with fraction, which means on average 1/fraction events are reported. see runtime.SetMutexProfileFraction MutexProfile is disabled by default. When using modest fraction (e.g. 100) MutexProfile has little impact on performance.

func WithMutexProfileDefault added in v1.3.6

func WithMutexProfileDefault() Option

func WithRetryCount

func WithRetryCount(count int) Option

WithRetryCount set retry count when data upload fail

type ProfileCollector

type ProfileCollector interface {
	Name() string
	FileName() string
	SupportDelta() bool //see go/src/net/http/pprof.go -> profileSupportsDelta
	GetPrevious() *profile.Profile
	SetPrevious(*profile.Profile)
	Collect(durationSeconds int64, isSnapshot, useCache bool, targetDeltaSampleTypes []common.SampleType) (*common.ProfileData, error)
}

func GetProfileCollector

func GetProfileCollector(pt common.ProfileType) ProfileCollector

type Profiler

type Profiler struct {
	// contains filtered or unexported fields
}

func NewProfiler

func NewProfiler(serviceType, service string, opts ...Option) *Profiler

NewProfiler fetch profileTasks from remoteConfig then profile and send pprof data to backend

func (*Profiler) DebugTasks

func (p *Profiler) DebugTasks(tasks []*common.Task)

DebugTasks create a debug task. DEBUG ONLY.

func (*Profiler) Start

func (p *Profiler) Start()

func (*Profiler) Stop

func (p *Profiler) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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