You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
628 B

package main
import (
"time"
"github.com/prometheus/client_golang/prometheus"
)
// SimpleGauge which will increment the incValue gauge by 1 every 5 seconds and promote it to /metrics
func SimpleGauge() {
incValue := prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "acme_company",
Subsystem: "blob_storage",
Name: "inc_value",
Help: "just an increased number.",
})
// register incValue
prometheus.MustRegister(incValue)
// loop over the ticker and call Inc function
go func() {
for range time.Tick(time.Second * 5) {
// increment incValue by 1 every 5 seconds
incValue.Inc()
}
}()
}