metrics

Imports

Imports #

"math"
"unsafe"
"internal/godebugs"
_ "runtime"
"unsafe"

Constants & Variables

KindBad const #

KindBad indicates that the Value has no type and should not be used.

const KindBad ValueKind = iota

KindFloat64 const #

KindFloat64 indicates that the type of the Value is a float64.

const KindFloat64

KindFloat64Histogram const #

KindFloat64Histogram indicates that the type of the Value is a *Float64Histogram.

const KindFloat64Histogram

KindUint64 const #

KindUint64 indicates that the type of the Value is a uint64.

const KindUint64

allDesc var #

The English language descriptions below must be kept in sync with the descriptions of each metric in doc.go by running 'go generate'.

var allDesc = []Description{...}

Type Aliases

ValueKind type #

ValueKind is a tag for a metric [Value] which indicates its type.

type ValueKind int

Structs

Description struct #

Description describes a runtime metric.

type Description struct {
Name string
Description string
Kind ValueKind
Cumulative bool
}

Float64Histogram struct #

Float64Histogram represents a distribution of float64 values.

type Float64Histogram struct {
Counts []uint64
Buckets []float64
}

Sample struct #

Sample captures a single metric sample.

type Sample struct {
Name string
Value Value
}

Value struct #

Value represents a metric value returned by the runtime.

type Value struct {
kind ValueKind
scalar uint64
pointer unsafe.Pointer
}

Functions

All function #

All returns a slice of containing metric descriptions for all supported metrics.

func All() []Description

Float64 method #

Float64 returns the internal float64 value for the metric. If v.Kind() != KindFloat64, this method panics.

func (v Value) Float64() float64

Float64Histogram method #

Float64Histogram returns the internal *Float64Histogram value for the metric. If v.Kind() != KindFloat64Histogram, this method panics.

func (v Value) Float64Histogram() *Float64Histogram

Kind method #

Kind returns the tag representing the kind of value this is.

func (v Value) Kind() ValueKind

Read function #

Read populates each [Value] field in the given slice of metric samples. Desired metrics should be present in the slice with the appropriate name. The user of this API is encouraged to re-use the same slice between calls for efficiency, but is not required to do so. Note that re-use has some caveats. Notably, Values should not be read or manipulated while a Read with that value is outstanding; that is a data race. This property includes pointer-typed Values (for example, [Float64Histogram]) whose underlying storage will be reused by Read when possible. To safely use such values in a concurrent setting, all data must be deep-copied. It is safe to execute multiple Read calls concurrently, but their arguments must share no underlying memory. When in doubt, create a new []Sample from scratch, which is always safe, though may be inefficient. Sample values with names not appearing in [All] will have their Value populated as KindBad to indicate that the name is unknown.

func Read(m []Sample)

Uint64 method #

Uint64 returns the internal uint64 value for the metric. If v.Kind() != KindUint64, this method panics.

func (v Value) Uint64() uint64

init function #

func init()

runtime_readMetrics function #

Implemented in the runtime.

func runtime_readMetrics(unsafe.Pointer, int, int)

Generated with Arrow