forked from mirror/client_golang
Examples: Replace deprecated WithGoCollections with WithGoCollectorRuntimeMetrics (#1130)
Signed-off-by: rogerogers <rogers@rogerogers.com> Signed-off-by: rogerogers <rogers@rogerogers.com>
This commit is contained in:
parent
7c46c150bd
commit
9801a4e3ce
|
@ -22,6 +22,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus/collectors"
|
"github.com/prometheus/client_golang/prometheus/collectors"
|
||||||
|
@ -39,7 +40,7 @@ func main() {
|
||||||
// Add Go module build info.
|
// Add Go module build info.
|
||||||
reg.MustRegister(collectors.NewBuildInfoCollector())
|
reg.MustRegister(collectors.NewBuildInfoCollector())
|
||||||
reg.MustRegister(collectors.NewGoCollector(
|
reg.MustRegister(collectors.NewGoCollector(
|
||||||
collectors.WithGoCollections(collectors.GoRuntimeMemStatsCollection | collectors.GoRuntimeMetricsCollection),
|
collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}),
|
||||||
))
|
))
|
||||||
|
|
||||||
// Expose the registered metrics via HTTP.
|
// Expose the registered metrics via HTTP.
|
||||||
|
|
Loading…
Reference in New Issue