metrics/gauge_example_test.go
Aliaksandr Valialkin bded4324a5 Added examples
2019-04-11 17:26:20 +03:00

19 lines
325 B
Go

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())
}