Fix deprecated `NewBuildInfoCollector` API

Update `examples/random/main.go`:
  `prometheus.NewBuildInfoCollector` is deprecated. Use `collectors.NewBuildInfoCollector` instead.

Signed-off-by: alissa-tung <alissa-tung@outlook.com>
This commit is contained in:
alissa-tung 2022-03-16 17:46:48 +08:00 committed by Kemal Akkoyun
parent 39cf574e99
commit 585540a010
1 changed files with 2 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import (
"time" "time"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
) )
@ -67,7 +68,7 @@ func main() {
prometheus.MustRegister(rpcDurations) prometheus.MustRegister(rpcDurations)
prometheus.MustRegister(rpcDurationsHistogram) prometheus.MustRegister(rpcDurationsHistogram)
// Add Go module build info. // Add Go module build info.
prometheus.MustRegister(prometheus.NewBuildInfoCollector()) prometheus.MustRegister(collectors.NewBuildInfoCollector())
start := time.Now() start := time.Now()