viewer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DefaultTemplate = `` /* 902-byte string literal not displayed */

	DefaultMaxPoints  = 40
	DefaultTimeFormat = "15:04:05"
	DefaultInterval   = 1500
	DefaultAddr       = "localhost:18066"
	DefaultTheme      = ThemeMacarons
)
View Source
const (
	VCStack = "stack"
)
View Source
const (
	VGCCPUFraction = "gccpufraction"
)
View Source
const (
	VGCNum = "gcnum"
)
View Source
const (
	VGCSzie = "gcsize"
)
View Source
const (
	VGoroutine = "goroutine"
)
View Source
const (
	VHeap = "heap"
)

Variables

This section is empty.

Functions

func Addr

func Addr() string

func Interval

func Interval() int

func SetConfiguration

func SetConfiguration(opts ...Option)

func StartRTCollect

func StartRTCollect()

Types

type GCCPUFractionViewer

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

GCCPUFractionViewer collects the GC-CPU fraction metric from `runtime.ReadMemStats()`

func (*GCCPUFractionViewer) Name

func (vr *GCCPUFractionViewer) Name() string

func (*GCCPUFractionViewer) Serve

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 from `runtime.ReadMemStats()`

func (*GCNumViewer) Name

func (vr *GCNumViewer) Name() string

func (*GCNumViewer) Serve

func (vr *GCNumViewer) Serve(w http.ResponseWriter, _ *http.Request)

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 from `runtime.ReadMemStats()`

func (*GCSizeViewer) Name

func (vr *GCSizeViewer) Name() string

func (*GCSizeViewer) Serve

func (vr *GCSizeViewer) Serve(w http.ResponseWriter, _ *http.Request)

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 from `runtime.NumGoroutine()`

func (*GoroutinesViewer) Name

func (vr *GoroutinesViewer) Name() string

func (*GoroutinesViewer) Serve

func (vr *GoroutinesViewer) Serve(w http.ResponseWriter, _ *http.Request)

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 from `runtime.ReadMemStats()` including `HeapAlloc` / `HeapInuse` / `HeapSys` / `HeapIdle`

func (*HeapViewer) Name

func (vr *HeapViewer) Name() string

func (*HeapViewer) Serve

func (vr *HeapViewer) Serve(w http.ResponseWriter, _ *http.Request)

func (*HeapViewer) View

func (vr *HeapViewer) View() *charts.Line

type Metrics

type Metrics struct {
	Values []float64 `json:"values"`
	Time   string    `json:"time"`
}

Metrics

type Option

type Option func(c *config)

func WithAddr

func WithAddr(addr string) Option

WithAddr sets the listen address

func WithInterval

func WithInterval(interval int) Option

WithInterval sets the interval of collecting and pulling metrics

func WithMaxPoints

func WithMaxPoints(n int) Option

WithMaxPoints sets the maximum points of each chart series

func WithTemplate

func WithTemplate(t string) Option

WithTemplate sets the rendered template which fetching stats from the server and handling the metrics data

func WithTheme

func WithTheme(theme Theme) Option

WithTheme sets the theme of the charts

func WithTimeFormat

func WithTimeFormat(s string) Option

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 from `runtime.ReadMemStats()` including `StackSys` / `StackInuse` / `MSpanSys` / `MSpanInuse`

func (*StackViewer) Name

func (vr *StackViewer) Name() string

func (*StackViewer) Serve

func (vr *StackViewer) Serve(w http.ResponseWriter, _ *http.Request)

func (*StackViewer) View

func (vr *StackViewer) View() *charts.Line

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)
}

func NewGCCPUFractionViewer

func NewGCCPUFractionViewer() Viewer

func NewGCNumViewer

func NewGCNumViewer() Viewer

func NewGCSizeViewer

func NewGCSizeViewer() Viewer

func NewGoroutinesViewer

func NewGoroutinesViewer() Viewer

func NewHeapViewer

func NewHeapViewer() Viewer

func NewStackViewer

func NewStackViewer() Viewer

Jump to

Keyboard shortcuts

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