runtimemetrics

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 11 Imported by: 8

Documentation

Overview

Package runtimemetrics provides a reporter for metrics data collected by package "runtime/metrics".

This is a reporter for package "runtime/metrics" which will submit the metrics to a metrics.Interface. See:

https://pkg.go.dev/runtime/metrics
https://pkg.go.dev/bitbucket.org/pcas/metrics

Example usage:

import (
	"bitbucket.org/pcas/metrics/runtimemetrics"
	"bitbucket.org/pcastools/log"
)

defer runtimemetrics.Start(
	m,							// The destination metrics.Interface
	runtimemetrics.DefaultSet,	// Use the default set of runtime metrics
	0,							// Use the default reporting interval
	log.Stderr,     			// Log any errors to stderr
)()

Index

Constants

View Source
const DefaultInterval = 5 * time.Second

DefaultInterval is the default reporting interval.

Variables

View Source
var DefaultSet = []string{
	"/cpu/classes/gc/total:cpu-seconds",
	"/cpu/classes/idle:cpu-seconds",
	"/cpu/classes/user:cpu-seconds",
	"/gc/cycles/total:gc-cycles",
	"/memory/classes/heap/objects:bytes",
	"/sched/goroutines/waiting:goroutines",
	"/sched/goroutines:goroutines",
}

DefaultSet is the default set of metrics to collect. This set may be adjusted in future updates.

Functions

func Start

func Start(m metrics.Interface, list []string, interval time.Duration, l log.Interface) func()

Start starts submitting the metrics named in 'list' to m, reporting with given interval. If the interval is <= 0 then DefaultInterval will be used. Any errors submitting metrics will be logged to l. Returns a cancel cancel function which will halt metric collection.

Types

This section is empty.

Jump to

Keyboard shortcuts

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