Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct { // PauseDur represents the interval in-between each set of stats output. // Defaults to 10 seconds. PauseDur time.Duration // EnableCPU determines whether CPU statistics will be output. Defaults to true. EnableCPU bool // EnableMem determines whether memory statistics will be output. Defaults to true. EnableMem bool // EnableGC determines whether garbage collection statistics will be output. EnableMem // must also be set to true for this to take affect. Defaults to true. EnableGC bool // Done, when closed, is used to signal Collector that is should stop collecting // statistics and the Run function should return. Done <-chan struct{} // contains filtered or unexported fields }
Collector implements the periodic grabbing of informational data from the runtime package and outputting the values to a GaugeFunc.
func New ¶
func New(fieldsFunc FieldsFunc) *Collector
New creates a new Collector that will periodically output statistics to fieldsFunc. It will also set the values of the exported fields to the described defaults. The values of the exported defaults can be changed at any point before Run is called.
type Fields ¶
type Fields struct { // CPU NumCpu int64 `json:"cpu.count"` NumGoroutine int64 `json:"cpu.goroutines"` NumCgoCall int64 `json:"cpu.cgo_calls"` // General Alloc int64 `json:"mem.alloc"` TotalAlloc int64 `json:"mem.total"` Sys int64 `json:"mem.sys"` Lookups int64 `json:"mem.lookups"` Mallocs int64 `json:"mem.malloc"` Frees int64 `json:"mem.frees"` // Heap HeapAlloc int64 `json:"mem.heap.alloc"` HeapSys int64 `json:"mem.heap.sys"` HeapIdle int64 `json:"mem.heap.idle"` HeapInuse int64 `json:"mem.heap.inuse"` HeapReleased int64 `json:"mem.heap.released"` HeapObjects int64 `json:"mem.heap.objects"` // Stack StackInuse int64 `json:"mem.stack.inuse"` StackSys int64 `json:"mem.stack.sys"` MSpanInuse int64 `json:"mem.stack.mspan_inuse"` MSpanSys int64 `json:"mem.stack.mspan_sys"` MCacheInuse int64 `json:"mem.stack.mcache_inuse"` MCacheSys int64 `json:"mem.stack.mcache_sys"` OtherSys int64 `json:"mem.othersys"` // GC GCSys int64 `json:"mem.gc.sys"` NextGC int64 `json:"mem.gc.next"` LastGC int64 `json:"mem.gc.last"` PauseTotalNs int64 `json:"mem.gc.pause_total"` PauseNs int64 `json:"mem.gc.pause"` NumGC int64 `json:"mem.gc.count"` GCCPUFraction float64 `json:"mem.gc.cpu_fraction"` Goarch string `json:"-"` Goos string `json:"-"` Version string `json:"-"` Timestamp int64 `json:"timestamp"` }
NOTE: uint64 is not supported by influxDB client due to potential overflows
type FieldsFunc ¶
type FieldsFunc func(Fields)
FieldsFunc represents a callback after successfully gathering statistics
Click to show internal directories.
Click to hide internal directories.