From 9801a4e3ceb49d24dfaf4fa6fc8c2d58aa3b2dc9 Mon Sep 17 00:00:00 2001 From: rogerogers <40619032+rogerogers@users.noreply.github.com> Date: Mon, 12 Sep 2022 17:24:20 +0800 Subject: [PATCH] Examples: Replace deprecated WithGoCollections with WithGoCollectorRuntimeMetrics (#1130) Signed-off-by: rogerogers Signed-off-by: rogerogers --- examples/gocollector/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/gocollector/main.go b/examples/gocollector/main.go index 93f8c22..9116314 100644 --- a/examples/gocollector/main.go +++ b/examples/gocollector/main.go @@ -22,6 +22,7 @@ import ( "fmt" "log" "net/http" + "regexp" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" @@ -39,7 +40,7 @@ func main() { // Add Go module build info. reg.MustRegister(collectors.NewBuildInfoCollector()) reg.MustRegister(collectors.NewGoCollector( - collectors.WithGoCollections(collectors.GoRuntimeMemStatsCollection | collectors.GoRuntimeMetricsCollection), + collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}), )) // Expose the registered metrics via HTTP.