Merge pull request #1000 from alissa-tung/patch-1

Fix deprecated `NewBuildInfoCollector` API
This commit is contained in:
Kemal Akkoyun 2022-03-17 08:36:01 +01:00 committed by GitHub
commit fe8d1e13cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,15 @@
# This Dockerfile builds an image for a client_golang example. # This Dockerfile builds an image for a client_golang example.
# #
# Use as (from the root for the client_golang repository): # Use as (from the root for the client_golang repository):
# docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name . # docker build -f Dockerfile -t prometheus/golang-example .
# Run as
# docker run -P prometheus/golang-example /random
# or
# docker run -P prometheus/golang-example /simple
# Test as
# curl $ip:$port/metrics
# Builder image, where we build the example. # Builder image, where we build the example.
FROM golang:1 AS builder FROM golang:1 AS builder

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()