Documentation ¶
Index ¶
- Constants
- func Addr() string
- func ConvertStringToArray(rawCsv string) []string
- func Interval() int
- func LinkAddr() string
- func SetConfiguration(opts ...Option)
- type CustomViewer
- type GCCPUFractionViewer
- type GCNumViewer
- type GCSizeViewer
- type GoroutinesViewer
- type HeapViewer
- type Metrics
- type Option
- type StackViewer
- type StatsMgr
- type Theme
- type Viewer
Constants ¶
const ( DefaultTemplate = `` /* 923-byte string literal not displayed */ DefaultMaxPoints = 30 DefaultTimeFormat = "15:04:05" DefaultInterval = 2000 DefaultAddr = "localhost:18066" DefaultTheme = ThemeMacarons )
const (
// VCStack is the name of StackViewer
VCStack = "stack"
)
const (
// VGCCPUFraction is the name of GCCPUFractionViewer
VGCCPUFraction = "gccpufraction"
)
const (
// VGCNum is the name of GCNumViewer
VGCNum = "gcnum"
)
const (
// VGCSzie is the name of GCSizeViewer
VGCSize = "gcsize"
)
const (
// VGoroutine is the name of GoroutinesViewer
VGoroutine = "goroutine"
)
const (
// VHeap is the name of HeapViewer
VHeap = "heap"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertStringToArray ¶
func SetConfiguration ¶
func SetConfiguration(opts ...Option)
Types ¶
type CustomViewer ¶
type CustomViewer struct {
// contains filtered or unexported fields
}
GCSizeViewer collects the GC size metric via `runtime.ReadMemStats()`
func (*CustomViewer) Name ¶
func (vr *CustomViewer) Name() string
func (*CustomViewer) Serve ¶
func (vr *CustomViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*CustomViewer) SetStatsMgr ¶
func (vr *CustomViewer) SetStatsMgr(smgr *StatsMgr)
func (*CustomViewer) View ¶
func (vr *CustomViewer) View() *charts.Line
type GCCPUFractionViewer ¶
type GCCPUFractionViewer struct {
// contains filtered or unexported fields
}
GCCPUFractionViewer collects the GC-CPU fraction metric via `runtime.ReadMemStats()`
func (*GCCPUFractionViewer) Name ¶
func (vr *GCCPUFractionViewer) Name() string
func (*GCCPUFractionViewer) Serve ¶
func (vr *GCCPUFractionViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*GCCPUFractionViewer) SetStatsMgr ¶
func (vr *GCCPUFractionViewer) SetStatsMgr(smgr *StatsMgr)
func (*GCCPUFractionViewer) View ¶
func (vr *GCCPUFractionViewer) View() *charts.Line
type GCNumViewer ¶
type GCNumViewer struct {
// contains filtered or unexported fields
}
GCNumViewer collects the GC number metric via `runtime.ReadMemStats()`
func (*GCNumViewer) Name ¶
func (vr *GCNumViewer) Name() string
func (*GCNumViewer) Serve ¶
func (vr *GCNumViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*GCNumViewer) SetStatsMgr ¶
func (vr *GCNumViewer) SetStatsMgr(smgr *StatsMgr)
func (*GCNumViewer) View ¶
func (vr *GCNumViewer) View() *charts.Line
type GCSizeViewer ¶
type GCSizeViewer struct {
// contains filtered or unexported fields
}
GCSizeViewer collects the GC size metric via `runtime.ReadMemStats()`
func (*GCSizeViewer) Name ¶
func (vr *GCSizeViewer) Name() string
func (*GCSizeViewer) Serve ¶
func (vr *GCSizeViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*GCSizeViewer) SetStatsMgr ¶
func (vr *GCSizeViewer) SetStatsMgr(smgr *StatsMgr)
func (*GCSizeViewer) View ¶
func (vr *GCSizeViewer) View() *charts.Line
type GoroutinesViewer ¶
type GoroutinesViewer struct {
// contains filtered or unexported fields
}
GoroutinesViewer collects the goroutine number metric via `runtime.NumGoroutine()`
func (*GoroutinesViewer) Name ¶
func (vr *GoroutinesViewer) Name() string
func (*GoroutinesViewer) Serve ¶
func (vr *GoroutinesViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*GoroutinesViewer) SetStatsMgr ¶
func (vr *GoroutinesViewer) SetStatsMgr(smgr *StatsMgr)
func (*GoroutinesViewer) View ¶
func (vr *GoroutinesViewer) View() *charts.Line
type HeapViewer ¶
type HeapViewer struct {
// contains filtered or unexported fields
}
HeapViewer collects the heap-stats metrics via `runtime.ReadMemStats()`
func (*HeapViewer) Name ¶
func (vr *HeapViewer) Name() string
func (*HeapViewer) Serve ¶
func (vr *HeapViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*HeapViewer) SetStatsMgr ¶
func (vr *HeapViewer) SetStatsMgr(smgr *StatsMgr)
func (*HeapViewer) View ¶
func (vr *HeapViewer) View() *charts.Line
type Option ¶
type Option func(c *config)
func WithInterval ¶
WithInterval sets the interval of collecting and pulling metrics
func WithMaxPoints ¶
WithMaxPoints sets the maximum points of each chart series
func WithTemplate ¶
WithTemplate sets the rendered template which fetching stats from the server and handling the metrics data
func WithTimeFormat ¶
WithTimeFormat sets the time format for the line-chart Y-axis label
type StackViewer ¶
type StackViewer struct {
// contains filtered or unexported fields
}
StackViewer collects the stack-stats metrics via `runtime.ReadMemStats()`
func (*StackViewer) Name ¶
func (vr *StackViewer) Name() string
func (*StackViewer) Serve ¶
func (vr *StackViewer) Serve(w http.ResponseWriter, _ *http.Request)
func (*StackViewer) SetStatsMgr ¶
func (vr *StackViewer) SetStatsMgr(smgr *StatsMgr)
func (*StackViewer) View ¶
func (vr *StackViewer) View() *charts.Line
type StatsMgr ¶
type StatsMgr struct { Ctx context.Context Cancel context.CancelFunc // contains filtered or unexported fields }
func NewStatsMgr ¶
type Theme ¶
type Theme string
const ( ThemeWesteros Theme = types.ThemeWesteros ThemeMacarons Theme = types.ThemeMacarons )
type Viewer ¶
type Viewer interface { Name() string View() *charts.Line Serve(w http.ResponseWriter, _ *http.Request) SetStatsMgr(smgr *StatsMgr) }
Viewer is the abstraction of a Graph which in charge of collecting metrics from somewhere
func NewCustom ¶
func NewCustom() Viewer
NewGCSizeViewer returns the GCSizeViewer instance Series: GCSys / NextGC
func NewGCCPUFractionViewer ¶
func NewGCCPUFractionViewer() Viewer
NewGCCPUFractionViewer returns the GCCPUFractionViewer instance Series: Fraction
func NewGCNumViewer ¶
func NewGCNumViewer() Viewer
NewGCNumViewer returns the GCNumViewer instance Series: GcNum
func NewGCSizeViewer ¶
func NewGCSizeViewer() Viewer
NewGCSizeViewer returns the GCSizeViewer instance Series: GCSys / NextGC
func NewGoroutinesViewer ¶
func NewGoroutinesViewer() Viewer
NewGoroutinesViewer returns the GoroutinesViewer instance Series: Goroutines
func NewHeapViewer ¶
func NewHeapViewer() Viewer
NewHeapViewer returns the HeapViewer instance Series: Alloc / Inuse / Sys / Idle
func NewStackViewer ¶
func NewStackViewer() Viewer
NewStackViewer returns the StackViewer instance Series: StackSys / StackInuse / MSpanSys / MSpanInuse