Documentation

Overview

Package runtimestats exposes metrics related to the Go runtime.

It exports the allocator statistics (go/mem/* metrics) and the current number of goroutines (go/goroutine/num).

Should be invoked manually for now. Call Report(c) to populate the metrics prior tsmon Flush.

Index

Constants

This section is empty.

Variables

View Source
var (
	MemAlloc       = metric.NewInt("go/mem/alloc", "Bytes allocated and not yet freed.", &types.MetricMetadata{types.Bytes})
	MemTotalAlloc  = metric.NewCounter("go/mem/total_alloc", "Bytes allocated (even if freed).", &types.MetricMetadata{types.Bytes})
	MemMallocs     = metric.NewCounter("go/mem/mallocs", "Number of mallocs.", nil)
	MemFrees       = metric.NewCounter("go/mem/frees", "Number of frees.", nil)
	MemNextGC      = metric.NewInt("go/mem/next_gc", "Next GC will happen when go/mem/alloc > this amount.", nil)
	MemNumGC       = metric.NewCounter("go/mem/num_gc", "Number of garbage collections.", nil)
	MemPauseTotal  = metric.NewCounter("go/mem/pause_total", "Total GC pause, in microseconds.", nil)
	MemHeapSys     = metric.NewInt("go/mem/heap_sys", "Bytes obtained from system.", &types.MetricMetadata{types.Bytes})
	MemHeapIdle    = metric.NewInt("go/mem/heap_idle", "Bytes in idle spans.", &types.MetricMetadata{types.Bytes})
	MemHeapInuse   = metric.NewInt("go/mem/heap_in_use", "Bytes in non-idle span.", &types.MetricMetadata{types.Bytes})
	MemHeapObjects = metric.NewInt("go/mem/heap_objects", "Total number of allocated objects.", nil)
	MemStackInuse  = metric.NewInt("go/mem/stack_in_use", "Bytes used by stack allocator.", &types.MetricMetadata{types.Bytes})
	MemStackSys    = metric.NewInt("go/mem/stack_in_sys", "Bytes allocated to stack allocator.", &types.MetricMetadata{types.Bytes})
	MemMSpanInuse  = metric.NewInt("go/mem/mspan_in_use", "Bytes used by mspan structures.", &types.MetricMetadata{types.Bytes})
	MemMSpanSys    = metric.NewInt("go/mem/mspan_in_sys", "Bytes allocated to mspan structures.", &types.MetricMetadata{types.Bytes})
	MemMCacheInuse = metric.NewInt("go/mem/mcache_in_use", "Bytes used by mcache structures.", &types.MetricMetadata{types.Bytes})
	MemMCacheSys   = metric.NewInt("go/mem/mcache_in_sys", "Bytes allocated to mcache structures.", &types.MetricMetadata{types.Bytes})

	GoroutineNum = metric.NewInt("go/goroutine/num", "The number of goroutines that currently exist.", nil)
)

Functions

func Report

func Report(c context.Context)

Report updates runtime stats metrics.

Call it periodically (ideally right before flushing the metrics) to gather runtime stats metrics.

Types

This section is empty.

Source Files