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"
|
||||
"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.
|
||||
|
|
Loading…
Reference in New Issue