Skip to content

Commit 9801a4e

Browse files
authored
Examples: Replace deprecated WithGoCollections with WithGoCollectorRuntimeMetrics (#1130)
Signed-off-by: rogerogers <[email protected]> Signed-off-by: rogerogers <[email protected]>
1 parent 7c46c15 commit 9801a4e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/gocollector/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"log"
2424
"net/http"
25+
"regexp"
2526

2627
"github.com/prometheus/client_golang/prometheus"
2728
"github.com/prometheus/client_golang/prometheus/collectors"
@@ -39,7 +40,7 @@ func main() {
3940
// Add Go module build info.
4041
reg.MustRegister(collectors.NewBuildInfoCollector())
4142
reg.MustRegister(collectors.NewGoCollector(
42-
collectors.WithGoCollections(collectors.GoRuntimeMemStatsCollection | collectors.GoRuntimeMetricsCollection),
43+
collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}),
4344
))
4445

4546
// Expose the registered metrics via HTTP.

0 commit comments

Comments
 (0)