Standard library / runtime/metrics

metrics.Read()

Fills sample values for requested names; unknown names produce KindBad. Concurrent calls must not share sample backing storage. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Read(m []Sample)

Parameters & Attributes

NameTypeDescription
m[]SampleSamples named with supported metric keys; their Value fields are overwritten.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime/metrics")
func main() {  s := []metrics.Sample{{Name: "/gc/heap/allocs:bytes"}}  metrics.Read(s)  fmt.Println(s[0].Value.Kind() == metrics.KindUint64)}
Go Reference