Documentation
Overview ¶
Package runmetrics contains support for runtime metrics.
To enable collecting runtime metrics, just call Enable():
_ := runmetrics.Enable(runmetrics.RunMetricOptions{ EnableCPU: true, EnableMemory: true, })
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enable ¶
func Enable(options RunMetricOptions) error
Enable enables collection of runtime metrics.
Supply RunMetricOptions to configure the behavior of metrics collection. An error might be returned, if creating metrics gauges fails.
Previous calls will be overwritten by subsequent ones.
Example ¶
Output: mayapp/process/cpu_cgo_calls 42 mayapp/process/cpu_goroutines 42 mayapp/process/heap_alloc 42 mayapp/process/heap_idle 42 mayapp/process/heap_inuse 42 mayapp/process/heap_objects 42 mayapp/process/heap_release 42 mayapp/process/memory_alloc 42 mayapp/process/memory_frees 42 mayapp/process/memory_lookups 42 mayapp/process/memory_malloc 42 mayapp/process/stack_inuse 42 mayapp/process/stack_mcache_inuse 42 mayapp/process/stack_mspan_inuse 42 mayapp/process/sys_heap 42 mayapp/process/sys_memory_alloc 42 mayapp/process/sys_stack 42 mayapp/process/sys_stack_mcache 42 mayapp/process/sys_stack_mspan 42 mayapp/process/total_memory_alloc 42
Types ¶
type RunMetricOptions ¶
type RunMetricOptions struct { EnableCPU bool // EnableCPU whether CPU metrics shall be recorded EnableMemory bool // EnableMemory whether memory metrics shall be recorded Prefix string // Prefix is a custom prefix for metric names }
RunMetricOptions allows to configure runtime metrics.