README.md: fixed NewGauge usage

This commit is contained in:
Aliaksandr Valialkin 2019-04-08 21:11:48 +03:00
parent d3611a2799
commit a62b8e250a

View File

@ -25,12 +25,15 @@ import "github.com/VictoriaMetrics/metrics"
var ( var (
requestsTotal = metrics.NewCounter("requests_total") requestsTotal = metrics.NewCounter("requests_total")
queueSize = metrics.NewGauge(`queue_size{queue="foobar"}`, func() float64 {
return float64(foobarQueue.Len())
})
requestDuration = metrics.NewSummary(`requests_duration_seconds{handler="/my/super/handler"}`) requestDuration = metrics.NewSummary(`requests_duration_seconds{handler="/my/super/handler"}`)
) )
func init() {
metrics.NewGauge(`queue_size{queue="foobar",topic="baz"}`, func() float64 {
return float64(foobarQueue.Len())
})
}
// ... // ...
func requestHandler() { func requestHandler() {
startTime := time.Now() startTime := time.Now()