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
parent 1f81b3e913
commit b05177a553
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()