metrics/gauge_example_test.go

19 lines
325 B
Go
Raw Normal View History

2019-04-11 17:26:20 +03:00
package metrics_test
import (
"fmt"
"runtime"
"github.com/VictoriaMetrics/metrics"
)
func ExampleGauge() {
// Define a gauge exporting the number of goroutines.
var g = metrics.NewGauge(`goroutines_count`, func() float64 {
return float64(runtime.NumGoroutine())
})
// Obtain gauge value.
fmt.Println(g.Get())
}