runtimemetrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package runtimemetrics exposes a go-kit metrics collector for Go runtime metrics.

It collects the following metrics:

go.goroutines - number of goroutines
go.mem.alloc-bytes - allocated bytes for heap objects
go.mem.sys-bytes - bytes requested from OS (may not all be used)
go.mem.total-alloc-bytes - cumulative total allocated bytes for heap objects
go.mem.mallocs - cumultative number of heap allocations
go.mem.frees - cumultaive number of freed heap objects
go.gc.pause-duration - histogram of GC pause durations
go.gc.next-target-heap-size-bytes - target heap size of the next GC cycle

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// Goroutines counts the number of goroutines.
	Goroutines kitmetrics.Gauge

	// AllocBytes counts the bytes of allocated heap objects.
	AllocBytes kitmetrics.Gauge

	// SysBytes is the total bytes of memory obtained from the OS.
	//
	// It's likely that not all of this virtual address space reserved by the Go
	// runtime is backed by physical memory at any given moment.
	SysBytes kitmetrics.Gauge

	// TotalAllocBytes is the cumulative total of bytes allocated for heap
	// objects.
	TotalAllocBytes kitmetrics.Gauge

	// Mallocs is the total count of heap objects ever allocated.
	Mallocs kitmetrics.Gauge

	// Frees is the total count of heap objects ever freed.
	Frees kitmetrics.Gauge

	// GCPauseDuration reports observed GC pause times.
	GCPauseDuration kitmetrics.Histogram

	// NextGCBytes is the target heap size of the next GC cycle.
	//
	// The garbage collector's goal is to keep AllocBytes ≤ NextGCBytes.
	NextGCBytes kitmetrics.Gauge
	// contains filtered or unexported fields
}

Collector collects metrics about the Go runtime into go-kit metrics.

func NewCollector

func NewCollector(p metrics.Provider) *Collector

NewCollector returns a collector whose metrics are registered with p.

func (*Collector) Collect

func (c *Collector) Collect()

Collect calls into the runtime to update its internal metrics.

Jump to

Keyboard shortcuts

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