Documentation
¶
Index ¶
- Constants
- func NewFileLog(path string, level mlog.Level) mlog.ErrorLogger
- func NewStdLogger() mlog.ErrorLogger
- type DumpOptions
- type Holmes
- func (h *Holmes) Alertf(alert string, format string, args ...interface{})
- func (h *Holmes) Debugf(format string, args ...interface{})
- func (h *Holmes) DisableCPUDump() *Holmes
- func (h *Holmes) DisableGCHeapDump() *Holmes
- func (h *Holmes) DisableGoroutineDump() *Holmes
- func (h *Holmes) DisableMemDump() *Holmes
- func (h *Holmes) DisableProfileReporter()
- func (h *Holmes) DisableShrinkThread() *Holmes
- func (h *Holmes) DisableThreadDump() *Holmes
- func (h *Holmes) EnableCPUDump() *Holmes
- func (h *Holmes) EnableDump(curCPU int) (err error)
- func (h *Holmes) EnableGCHeapDump() *Holmes
- func (h *Holmes) EnableGoroutineDump() *Holmes
- func (h *Holmes) EnableMemDump() *Holmes
- func (h *Holmes) EnableProfileReporter()
- func (h *Holmes) EnableShrinkThread() *Holmes
- func (h *Holmes) EnableThreadDump() *Holmes
- func (h *Holmes) Errorf(format string, args ...interface{})
- func (h *Holmes) Infof(format string, args ...interface{})
- func (h *Holmes) ReportProfile(pType string, buf []byte, reason string, eventID string)
- func (h *Holmes) Set(opts ...Option) error
- func (h *Holmes) Start()
- func (h *Holmes) Stop()
- func (h *Holmes) Warnf(format string, args ...interface{})
- type Option
- func WithBinaryDump() Option
- func WithCGroup(useCGroup bool) Option
- func WithCPUCore(cpuCore float64) Option
- func WithCPUDump(min int, diff int, abs int, coolDown time.Duration) Option
- func WithCPUMax(max int) Option
- func WithCollectInterval(interval string) Option
- func WithDumpPath(dumpPath string) Option
- func WithDumpToLogger(new bool) Option
- func WithFullStack(isFull bool) Option
- func WithGCHeapDump(min int, diff int, abs int, coolDown time.Duration) Option
- func WithGoProcAsCPUCore(enabled bool) Option
- func WithGoroutineDump(min int, diff int, abs int, max int, coolDown time.Duration) Option
- func WithLogger(logger mlog.ErrorLogger) Option
- func WithMemDump(min int, diff int, abs int, coolDown time.Duration) Option
- func WithMemoryLimit(limit uint64) Option
- func WithProfileReporter(r ProfileReporter) Option
- func WithShrinkThread(threshold int, delay time.Duration) Option
- func WithTextDump() Option
- func WithThreadDump(min, diff, abs int, coolDown time.Duration) Option
- type ProfileReporter
- type ReporterOptions
- type ShrinkThrOptions
Constants ¶
const ( // TrimResultTopN trimResult return only reserve the top n. TrimResultTopN = 10 // TrimResultMaxBytes trimResultFront return only reserve the front n bytes. TrimResultMaxBytes = 512000 // NotSupportTypeMaxConfig means this profile type is // not support control dump profile by max parameter. NotSupportTypeMaxConfig = 0 // UniformLogFormat is the format of uniform logging. UniformLogFormat = "[Holmes] %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 NewFileLog ¶
func NewFileLog(path string, level mlog.Level) mlog.ErrorLogger
func NewStdLogger ¶
func NewStdLogger() mlog.ErrorLogger
NewStdLogger create an ErrorLogger interface value that writing to os.Stdout
Types ¶
type DumpOptions ¶
type DumpOptions 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 // dump profile to logger. It will make huge log output if enable DumpToLogger option. issues/90 DumpToLogger bool }
DumpOptions contains configuration about dump file.
type Holmes ¶
type Holmes struct { // lock Protect the following sync.Mutex // contains filtered or unexported fields }
Holmes is a self-aware profile dumper.
func (*Holmes) DisableCPUDump ¶
DisableCPUDump disables the CPU dump.
func (*Holmes) DisableGCHeapDump ¶
DisableGCHeapDump disables the gc heap dump.
func (*Holmes) DisableGoroutineDump ¶
DisableGoroutineDump disables the goroutine dump.
func (*Holmes) DisableMemDump ¶
DisableMemDump disables the mem dump.
func (*Holmes) DisableProfileReporter ¶
func (h *Holmes) DisableProfileReporter()
func (*Holmes) DisableShrinkThread ¶
DisableShrinkThread disables shrink thread
func (*Holmes) DisableThreadDump ¶
DisableThreadDump disables the goroutine dump.
func (*Holmes) EnableCPUDump ¶
EnableCPUDump enables the CPU dump.
func (*Holmes) EnableDump ¶
func (*Holmes) EnableGCHeapDump ¶
EnableGCHeapDump enables the GC heap dump.
func (*Holmes) EnableGoroutineDump ¶
EnableGoroutineDump enables the goroutine dump.
func (*Holmes) EnableMemDump ¶
EnableMemDump enables the mem dump.
func (*Holmes) EnableProfileReporter ¶
func (h *Holmes) EnableProfileReporter()
func (*Holmes) EnableShrinkThread ¶
EnableShrinkThread enables shrink thread
func (*Holmes) EnableThreadDump ¶
EnableThreadDump enables the goroutine dump.
func (*Holmes) ReportProfile ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option holmes option type.
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 WithDumpPath ¶
WithDumpPath set the dump path for holmes.
func WithDumpToLogger ¶ added in v1.0.1
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 holmes use cgroup or not.
func WithGoroutineDump ¶
WithGoroutineDump set the goroutine dump options.
func WithLogger ¶
func WithLogger(logger mlog.ErrorLogger) Option
WithLogger set the logger logger can be created by: NewFileLog("/path/to/log/file", level)
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) 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.
type ProfileReporter ¶
type ReporterOptions ¶
type ReporterOptions struct {
// contains filtered or unexported fields
}
type ShrinkThrOptions ¶
type ShrinkThrOptions 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. }
ShrinkThrOptions contains the configuration about shrink thread