Standard library / runtime/metrics
metrics.Value.Float64()
Returns the floating-point metric; panics if the kind is not KindFloat64. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) Float64() float64Return Value
float64
Floating-point value of a metric tagged KindFloat64.
Working Example
Example Snippetgo
package main
import ( "fmt" "runtime/metrics")
func main() { s := []metrics.Sample{{Name: "/cpu/classes/total:cpu-seconds"}} metrics.Read(s) fmt.Println(s[0].Value.Float64() >= 0)}