Skip to content

Commit

Permalink
Examples: Replace deprecated WithGoCollections with WithGoCollectorRu…
Browse files Browse the repository at this point in the history
…ntimeMetrics (#1130)

Signed-off-by: rogerogers <rogers@rogerogers.com>

Signed-off-by: rogerogers <rogers@rogerogers.com>
  • Loading branch information
rogerogers committed Sep 12, 2022
1 parent 7c46c15 commit 9801a4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/gocollector/main.go
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"log"
"net/http"
"regexp"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
Expand All @@ -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.
Expand Down

0 comments on commit 9801a4e

Please sign in to comment.