package runtime implements the work-in-progress conventional runtime metrics specified by OpenTelemetry.

The metrics produced are:

runtime.go.cgo.calls         -          Number of cgo calls made by the current process
runtime.go.gc.count          -          Number of completed garbage collection cycles
runtime.go.gc.pause_ns       (ns)       Amount of nanoseconds in GC stop-the-world pauses
runtime.go.gc.pause_total_ns (ns)       Cumulative nanoseconds in GC stop-the-world pauses since the program started
runtime.go.goroutines        -          Number of goroutines that currently exist
runtime.go.lookups           -          Number of pointer lookups performed by the runtime
runtime.go.mem.heap_alloc    (bytes)    Bytes of allocated heap objects
runtime.go.mem.heap_idle     (bytes)    Bytes in idle (unused) spans
runtime.go.mem.heap_inuse    (bytes)    Bytes in in-use spans
runtime.go.mem.heap_objects  -          Number of allocated heap objects
runtime.go.mem.heap_released (bytes)    Bytes of idle spans whose physical memory has been returned to the OS
runtime.go.mem.heap_sys      (bytes)    Bytes of heap memory obtained from the OS
runtime.go.mem.live_objects  -          Number of live objects is the number of cumulative Mallocs - Frees
runtime.uptime               (ms)       Milliseconds since application was initialized



This section is empty.


This section is empty.


This section is empty.


type Runtime

type Runtime struct {
	// contains filtered or unexported fields

Runtime reports the work-in-progress conventional runtime metrics specified by OpenTelemetry

func New

func New(meter metric.Meter, interval time.Duration) *Runtime

New returns Runtime, a structure for reporting Go runtime metrics interval is used to define how often to invoke Go runtime.ReadMemStats() to obtain metric data. It should be noted this package invokes a stop-the-world function on this interval. The interval should not be set arbitrarily small without accepting the performance overhead. TODO this interval may be removed in favor of otel SDK control after batch observers land

func (*Runtime) Start

func (r *Runtime) Start() error

Start begins regular background polling of Go runtime metrics and will return an error if any issues are encountered

func (*Runtime) Stop

func (r *Runtime) Stop()

Stop terminates the regular background polling of Go runtime metrics

Source Files


Path Synopsis