Documentation ¶
Index ¶
- Constants
- func WithBinaryDump() options.Option
- func WithCGroup(useCGroup bool) options.Option
- func WithCPUCore(cpuCore float64) options.Option
- func WithCPUDump(min int, diff int, abs int) options.Option
- func WithCPUMax(max int) options.Option
- func WithCollectInterval(interval string) options.Option
- func WithCoolDown(coolDown string) options.Option
- func WithDumpPath(dumpPath string, loginfo ...string) options.Option
- func WithFullStack(isFull bool) options.Option
- func WithGCHeapDump(min int, diff int, abs int) options.Option
- func WithGoProcAsCPUCore(enabled bool) options.Option
- func WithGoroutineDump(min int, diff int, abs int, max int) options.Option
- func WithLoggerLevel(level int) options.Option
- func WithLoggerSplit(enable bool, shardLoggerSize string) options.Option
- func WithMemDump(min int, diff int, abs int) options.Option
- func WithMemoryLimit(limit uint64) options.Option
- func WithProfileReporter(r ProfileReporter) options.Option
- func WithShrinkThread(enable bool, threshold int, delay time.Duration) options.Option
- func WithTextDump() options.Option
- func WithThreadDump(min, diff, abs int) options.Option
- type DumpConfigs
- type HttpReporter
- type ProfileReporter
- type ReporterConfigs
- type Response
- type ShrinkThrConfigs
- type Watching
- func (w *Watching) DisableCPUDump() *Watching
- func (w *Watching) DisableGCHeapDump() *Watching
- func (w *Watching) DisableGoroutineDump() *Watching
- func (w *Watching) DisableMemDump() *Watching
- func (w *Watching) DisableProfileReporter()
- func (w *Watching) DisableThreadDump() *Watching
- func (w *Watching) EnableCPUDump() *Watching
- func (w *Watching) EnableDump(curCPU int) (err error)
- func (w *Watching) EnableGCHeapDump() *Watching
- func (w *Watching) EnableGoroutineDump() *Watching
- func (w *Watching) EnableMemDump() *Watching
- func (w *Watching) EnableProfileReporter()
- func (w *Watching) EnableThreadDump() *Watching
- func (w *Watching) Start()
- func (w *Watching) Stop()
Constants ¶
const ( LogLevelInfo = iota LogLevelDebug )
const ( // TrimResultTopN trimResult return only reserve the top n. TrimResultTopN = 10 // NotSupportTypeMaxConfig means this profile type is // not support control dump profile by max parameter. NotSupportTypeMaxConfig = 0 // UniformLogFormat is the format of uniform logging. UniformLogFormat = "[Watching] %v %v, config_min : %v, config_diff : %v, config_abs : %v, config_max : %v, previous : %v, current: %v" )
Variables ¶
This section is empty.
Functions ¶
func WithCGroup ¶
WithCGroup set Watching use cgroup or not.
func WithCPUCore ¶
WithCPUCore overwrite the system level CPU core number when it > 0. it's not a good idea to modify it on fly since it affects the CPU percent caculation.
func WithCPUDump ¶
WithCPUDump set the cpu dump options.
func WithCPUMax ¶
WithCPUMax : set the CPUMaxPercent parameter as max
func WithCollectInterval ¶
WithCollectInterval : interval must be valid time duration string, eg. "ns", "us" (or "µs"), "ms", "s", "m", "h".
func WithCoolDown ¶
WithCoolDown : coolDown must be valid time duration string, eg. "ns", "us" (or "µs"), "ms", "s", "m", "h".
func WithDumpPath ¶
WithDumpPath set the dump path for Watching.
func WithFullStack ¶
WithFullStack set to dump full stack or top 10 stack, when dump in text mode.
func WithGCHeapDump ¶
WithGCHeapDump set the GC heap dump options.
func WithGoProcAsCPUCore ¶
WithGoProcAsCPUCore set Watching use cgroup or not.
func WithGoroutineDump ¶
WithGoroutineDump set the goroutine dump options.
func WithLoggerLevel ¶
WithLoggerLevel set logger level
func WithLoggerSplit ¶
WithLoggerSplit set the split log options. eg. "b/B", "k/K" "kb/Kb" "mb/Mb", "gb/Gb" "tb/Tb" "pb/Pb".
func WithMemDump ¶
WithMemDump set the memory dump options.
func WithMemoryLimit ¶
WithMemoryLimit overwrite the system level memory limit when it > 0.
func WithProfileReporter ¶
func WithProfileReporter(r ProfileReporter) options.Option
WithProfileReporter will enable reporter reopens profile reporter through WithProfileReporter(h.opts.rptOpts.reporter)
func WithShrinkThread ¶
WithShrinkThread enable/disable shrink thread when the thread number exceed the max threshold.
func WithThreadDump ¶
WithThreadDump set the thread dump options.
Types ¶
type DumpConfigs ¶
type DumpConfigs struct { // full path to put the profile files, default /tmp DumpPath string // default dump to binary profile, set to true if you want a text profile DumpProfileType dumpProfileType // only dump top 10 if set to false, otherwise dump all, only effective when in_text = true DumpFullStack bool }
DumpConfigs contains configuration about dump file.
type HttpReporter ¶
type HttpReporter struct {
// contains filtered or unexported fields
}
type ProfileReporter ¶
type ProfileReporter interface {
Report(pType string, buf []byte, reason string, eventID string) error
}
func NewReporter ¶
func NewReporter(token string, url string) ProfileReporter
type ReporterConfigs ¶
type ReporterConfigs struct {
// contains filtered or unexported fields
}
type ShrinkThrConfigs ¶
type ShrinkThrConfigs struct { // shrink the thread number when it exceeds the max threshold that specified in Threshold Enable bool Threshold int Delay time.Duration // start to shrink thread after the delay time. }
ShrinkThrConfigs contains the configuration about shrink thread
type Watching ¶
type Watching struct { // lock Protect the following sync.Mutex // contains filtered or unexported fields }
func NewWatching ¶
func (*Watching) DisableCPUDump ¶
DisableCPUDump disables the CPU dump.
func (*Watching) DisableGCHeapDump ¶
DisableGCHeapDump disables the GC heap dump.
func (*Watching) DisableGoroutineDump ¶
DisableGoroutineDump disables the goroutine dump.
func (*Watching) DisableMemDump ¶
DisableMemDump disables the mem dump.
func (*Watching) DisableProfileReporter ¶
func (w *Watching) DisableProfileReporter()
func (*Watching) DisableThreadDump ¶
DisableThreadDump disables the goroutine dump.
func (*Watching) EnableCPUDump ¶
EnableCPUDump enables the CPU dump.
func (*Watching) EnableDump ¶
func (*Watching) EnableGCHeapDump ¶
EnableGCHeapDump enables the GC heap dump.
func (*Watching) EnableGoroutineDump ¶
EnableGoroutineDump enables the goroutine dump.
func (*Watching) EnableMemDump ¶
EnableMemDump enables the mem dump.
func (*Watching) EnableProfileReporter ¶
func (w *Watching) EnableProfileReporter()
func (*Watching) EnableThreadDump ¶
EnableThreadDump enables the goroutine dump.