diff --git a/examples/gocollector/main.go b/examples/gocollector/main.go index 93f8c227b..9116314a5 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.